aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/utils/server/servers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-11 14:09:23 +0100
committerChocobozzz <me@florianbigard.com>2019-02-11 14:09:23 +0100
commitb718fd22374d64534bcfe69932cf562894abed6a (patch)
tree311d3c67e2a4d1f33ebdd1dc163527de9d33d0f7 /shared/utils/server/servers.ts
parentadb115f5522bea4d52456a9fc5eb4140bb064476 (diff)
parent501e961199578129629cf0567033d13efced9904 (diff)
downloadPeerTube-b718fd22374d64534bcfe69932cf562894abed6a.tar.gz
PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.tar.zst
PeerTube-b718fd22374d64534bcfe69932cf562894abed6a.zip
Merge branch 'develop' into pr/1285
Diffstat (limited to 'shared/utils/server/servers.ts')
-rw-r--r--shared/utils/server/servers.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/shared/utils/server/servers.ts b/shared/utils/server/servers.ts
index 568385a41..bde7dd5c2 100644
--- a/shared/utils/server/servers.ts
+++ b/shared/utils/server/servers.ts
@@ -145,8 +145,16 @@ function runServer (serverNumber: number, configOverride?: Object, args = []) {
145 if (dontContinue === true) return 145 if (dontContinue === true) return
146 146
147 server.app.stdout.removeListener('data', onStdout) 147 server.app.stdout.removeListener('data', onStdout)
148
149 process.on('exit', () => {
150 try {
151 process.kill(server.app.pid)
152 } catch { /* empty */ }
153 })
154
148 res(server) 155 res(server)
149 }) 156 })
157
150 }) 158 })
151} 159}
152 160
@@ -158,9 +166,13 @@ async function reRunServer (server: ServerInfo, configOverride?: any) {
158} 166}
159 167
160async function checkTmpIsEmpty (server: ServerInfo) { 168async function checkTmpIsEmpty (server: ServerInfo) {
169 return checkDirectoryIsEmpty(server, 'tmp')
170}
171
172async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) {
161 const testDirectory = 'test' + server.serverNumber 173 const testDirectory = 'test' + server.serverNumber
162 174
163 const directoryPath = join(root(), testDirectory, 'tmp') 175 const directoryPath = join(root(), testDirectory, directory)
164 176
165 const directoryExists = existsSync(directoryPath) 177 const directoryExists = existsSync(directoryPath)
166 expect(directoryExists).to.be.true 178 expect(directoryExists).to.be.true
@@ -191,6 +203,7 @@ async function waitUntilLog (server: ServerInfo, str: string, count = 1) {
191// --------------------------------------------------------------------------- 203// ---------------------------------------------------------------------------
192 204
193export { 205export {
206 checkDirectoryIsEmpty,
194 checkTmpIsEmpty, 207 checkTmpIsEmpty,
195 ServerInfo, 208 ServerInfo,
196 flushAndRunMultipleServers, 209 flushAndRunMultipleServers,