X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube-watch.ts;h=b8e750a375b216ca8922842048f5ba1674cb7df9;hb=99fa5c5badd4f4d35a1d55c80b0102ee1c4e71cd;hp=7c27c13642c5ab4880812637b332f3059dec2230;hpb=b91bc1d1f3591c35ab4426f6ab594b4bd9f1ef62;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-watch.ts b/server/tools/peertube-watch.ts index 7c27c1364..b8e750a37 100644 --- a/server/tools/peertube-watch.ts +++ b/server/tools/peertube-watch.ts @@ -1,3 +1,6 @@ +import { registerTSPaths } from '../helpers/register-ts-paths' +registerTSPaths() + import * as program from 'commander' import { join } from 'path' import { execSync } from 'child_process' @@ -26,16 +29,10 @@ program console.log(' $ peertube watch https://peertube.cpy.re/videos/watch/e8a1af4e-414a-4d58-bfe6-2146eed06d10') console.log() }) - .action((url, cmd) => { - run(url, cmd) - .catch(err => { - console.error(err) - process.exit(-1) - }) - }) + .action((url, cmd) => run(url, cmd)) .parse(process.argv) -async function run (url: string, program: any) { +function run (url: string, program: any) { if (!url) { console.error(' positional argument is required.') process.exit(-1) @@ -46,5 +43,10 @@ async function run (url: string, program: any) { url.replace('videos/watch', 'download/torrents') + `-${program.resolution}.torrent` - execSync(cmd + args) + try { + execSync(cmd + args) + } catch (err) { + console.error('Cannto exec command.', err) + process.exit(-1) + } }