diff options
Diffstat (limited to 'shared/utils/server/servers.ts')
-rw-r--r-- | shared/utils/server/servers.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/shared/utils/server/servers.ts b/shared/utils/server/servers.ts index 1e9c83c72..bde7dd5c2 100644 --- a/shared/utils/server/servers.ts +++ b/shared/utils/server/servers.ts | |||
@@ -146,7 +146,11 @@ function runServer (serverNumber: number, configOverride?: Object, args = []) { | |||
146 | 146 | ||
147 | server.app.stdout.removeListener('data', onStdout) | 147 | server.app.stdout.removeListener('data', onStdout) |
148 | 148 | ||
149 | process.on('exit', () => process.kill(server.app.pid)) | 149 | process.on('exit', () => { |
150 | try { | ||
151 | process.kill(server.app.pid) | ||
152 | } catch { /* empty */ } | ||
153 | }) | ||
150 | 154 | ||
151 | res(server) | 155 | res(server) |
152 | }) | 156 | }) |
@@ -162,9 +166,13 @@ async function reRunServer (server: ServerInfo, configOverride?: any) { | |||
162 | } | 166 | } |
163 | 167 | ||
164 | async function checkTmpIsEmpty (server: ServerInfo) { | 168 | async function checkTmpIsEmpty (server: ServerInfo) { |
169 | return checkDirectoryIsEmpty(server, 'tmp') | ||
170 | } | ||
171 | |||
172 | async function checkDirectoryIsEmpty (server: ServerInfo, directory: string) { | ||
165 | const testDirectory = 'test' + server.serverNumber | 173 | const testDirectory = 'test' + server.serverNumber |
166 | 174 | ||
167 | const directoryPath = join(root(), testDirectory, 'tmp') | 175 | const directoryPath = join(root(), testDirectory, directory) |
168 | 176 | ||
169 | const directoryExists = existsSync(directoryPath) | 177 | const directoryExists = existsSync(directoryPath) |
170 | expect(directoryExists).to.be.true | 178 | expect(directoryExists).to.be.true |
@@ -195,6 +203,7 @@ async function waitUntilLog (server: ServerInfo, str: string, count = 1) { | |||
195 | // --------------------------------------------------------------------------- | 203 | // --------------------------------------------------------------------------- |
196 | 204 | ||
197 | export { | 205 | export { |
206 | checkDirectoryIsEmpty, | ||
198 | checkTmpIsEmpty, | 207 | checkTmpIsEmpty, |
199 | ServerInfo, | 208 | ServerInfo, |
200 | flushAndRunMultipleServers, | 209 | flushAndRunMultipleServers, |