]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tools/peertube-repl.ts
Fix comment notifications
[github/Chocobozzz/PeerTube.git] / server / tools / peertube-repl.ts
index 6800ff8ab99b10259ee69ad425cbdfd720c3e644..fbdec16132ad0580ae500a9b15be6cdf47eae3b3 100644 (file)
@@ -20,14 +20,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 +43,7 @@ const start = async () => {
         Object.defineProperty(context, prop, {
           configurable: false,
           enumerable: true,
-          value: properties[prop]
+          value: properties[ prop ]
         })
       }
     }
@@ -59,6 +55,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 +69,7 @@ const start = async () => {
 
 }
 
-start().then((data) => {
-  // do nothing
-}).catch((err) => {
-  console.error(err)
-})
+start()
+  .catch((err) => {
+    console.error(err)
+  })