X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fpeertube-repl.ts;h=ab6e215d9dc26f431797bf4166506ea14b64ac52;hb=837666fe48f9ed786db75c96e2025cbcf20a1e3b;hp=6800ff8ab99b10259ee69ad425cbdfd720c3e644;hpb=c141f68be14193fb92d3f5cfc82cd1e156823c17;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/peertube-repl.ts b/server/tools/peertube-repl.ts index 6800ff8ab..ab6e215d9 100644 --- a/server/tools/peertube-repl.ts +++ b/server/tools/peertube-repl.ts @@ -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) + })