diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 10:20:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 08642a765ea514a00f159db898edf14c376fbe6c (patch) | |
tree | 92a4cbe2b7257c04bfdeedd881af7833141aa151 /shared | |
parent | 59bbcced37005dd511daca9bd58ae2998cb931b1 (diff) | |
download | PeerTube-08642a765ea514a00f159db898edf14c376fbe6c.tar.gz PeerTube-08642a765ea514a00f159db898edf14c376fbe6c.tar.zst PeerTube-08642a765ea514a00f159db898edf14c376fbe6c.zip |
Fix server run
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/server/server.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/shared/extra-utils/server/server.ts b/shared/extra-utils/server/server.ts index b1347661f..cc6df2efe 100644 --- a/shared/extra-utils/server/server.ts +++ b/shared/extra-utils/server/server.ts | |||
@@ -219,6 +219,8 @@ export class PeerTubeServer { | |||
219 | } | 219 | } |
220 | 220 | ||
221 | return new Promise<void>(res => { | 221 | return new Promise<void>(res => { |
222 | const self = this | ||
223 | |||
222 | this.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions) | 224 | this.app = fork(join(root(), 'dist', 'server.js'), args, forkOptions) |
223 | this.app.stdout.on('data', function onStdout (data) { | 225 | this.app.stdout.on('data', function onStdout (data) { |
224 | let dontContinue = false | 226 | let dontContinue = false |
@@ -228,10 +230,10 @@ export class PeerTubeServer { | |||
228 | const regexp = regexps[key] | 230 | const regexp = regexps[key] |
229 | const matches = data.toString().match(regexp) | 231 | const matches = data.toString().match(regexp) |
230 | if (matches !== null) { | 232 | if (matches !== null) { |
231 | if (key === 'client_id') this.store.client.id = matches[1] | 233 | if (key === 'client_id') self.store.client.id = matches[1] |
232 | else if (key === 'client_secret') this.store.client.secret = matches[1] | 234 | else if (key === 'client_secret') self.store.client.secret = matches[1] |
233 | else if (key === 'user_username') this.store.user.username = matches[1] | 235 | else if (key === 'user_username') self.store.user.username = matches[1] |
234 | else if (key === 'user_password') this.store.user.password = matches[1] | 236 | else if (key === 'user_password') self.store.user.password = matches[1] |
235 | } | 237 | } |
236 | } | 238 | } |
237 | 239 | ||
@@ -247,12 +249,12 @@ export class PeerTubeServer { | |||
247 | if (options.hideLogs === false) { | 249 | if (options.hideLogs === false) { |
248 | console.log(data.toString()) | 250 | console.log(data.toString()) |
249 | } else { | 251 | } else { |
250 | this.app.stdout.removeListener('data', onStdout) | 252 | self.app.stdout.removeListener('data', onStdout) |
251 | } | 253 | } |
252 | 254 | ||
253 | process.on('exit', () => { | 255 | process.on('exit', () => { |
254 | try { | 256 | try { |
255 | process.kill(this.server.app.pid) | 257 | process.kill(self.server.app.pid) |
256 | } catch { /* empty */ } | 258 | } catch { /* empty */ } |
257 | }) | 259 | }) |
258 | 260 | ||