]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/peertube-watch.ts
Fix theater mode
[github/Chocobozzz/PeerTube.git] / server / tools / peertube-watch.ts
index 7c27c13642c5ab4880812637b332f3059dec2230..b8e750a375b216ca8922842048f5ba1674cb7df9 100644 (file)
@@ -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('<url> 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)
+  }
 }