]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/peertube-repl.ts
Fix duplicate HLS resolution in master playlist
[github/Chocobozzz/PeerTube.git] / server / tools / peertube-repl.ts
index 6800ff8ab99b10259ee69ad425cbdfd720c3e644..ab6e215d9dc26f431797bf4166506ea14b64ac52 100644 (file)
@@ -1,3 +1,6 @@
+import { registerTSPaths } from '../helpers/register-ts-paths'
+registerTSPaths()
+
 import * as repl from 'repl'
 import * as path from 'path'
 import * as _ from 'lodash'
@@ -20,14 +23,10 @@ import * as signupUtils from '../helpers/signup'
 import * as utils from '../helpers/utils'
 import * as YoutubeDLUtils from '../helpers/youtube-dl'
 
-let versionCommitHash
-
 const start = async () => {
   await initDatabaseModels(true)
 
-  await utils.getVersion().then((data) => {
-    versionCommitHash = data
-  })
+  const versionCommitHash = await utils.getServerCommit()
 
   const initContext = (replServer) => {
     return (context) => {
@@ -47,7 +46,7 @@ const start = async () => {
         Object.defineProperty(context, prop, {
           configurable: false,
           enumerable: true,
-          value: properties[prop]
+          value: properties[ prop ]
         })
       }
     }
@@ -59,6 +58,7 @@ const start = async () => {
 
   initContext(replServer)(replServer.context)
   replServer.on('reset', initContext(replServer))
+  replServer.on('exit', () => process.exit())
 
   const resetCommand = {
     help: 'Reset REPL',
@@ -72,8 +72,7 @@ const start = async () => {
 
 }
 
-start().then((data) => {
-  // do nothing
-}).catch((err) => {
-  console.error(err)
-})
+start()
+  .catch((err) => {
+    console.error(err)
+  })