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 | |
parent | 59bbcced37005dd511daca9bd58ae2998cb931b1 (diff) | |
download | PeerTube-08642a765ea514a00f159db898edf14c376fbe6c.tar.gz PeerTube-08642a765ea514a00f159db898edf14c376fbe6c.tar.zst PeerTube-08642a765ea514a00f159db898edf14c376fbe6c.zip |
Fix server run
-rw-r--r-- | server/tests/api/check-params/video-comments.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/server/server.ts | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index ea5340b40..92c29da0e 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts | |||
@@ -38,7 +38,7 @@ describe('Test video comments API validator', function () { | |||
38 | await setAccessTokensToServers([ server ]) | 38 | await setAccessTokensToServers([ server ]) |
39 | 39 | ||
40 | { | 40 | { |
41 | const video = await server.videos.upload({ attributes: {} }) | 41 | video = await server.videos.upload({ attributes: {} }) |
42 | pathThread = '/api/v1/videos/' + video.uuid + '/comment-threads' | 42 | pathThread = '/api/v1/videos/' + video.uuid + '/comment-threads' |
43 | } | 43 | } |
44 | 44 | ||
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 | ||