Skip to content

Commit 8b71d6a

Browse files
committed
Ensure Mockttp is properly shut down on clean exits
1 parent a20754b commit 8b71d6a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IS_PROD_BUILD, MOCKTTP_ALLOWED_ORIGINS } from './constants';
2424

2525
import { readFile, checkAccess, writeFile, ensureDirectoryExists } from './util/fs';
2626

27-
import { registerShutdownHandler, shutdown } from './shutdown';
27+
import { addShutdownHandler, registerShutdownHandler, shutdown } from './shutdown';
2828
import { getTimeToCertExpiry, parseCert } from './certificates';
2929

3030
import {
@@ -219,6 +219,8 @@ export async function runHTK(options: {
219219
host: '127.0.0.1'
220220
});
221221

222+
addShutdownHandler(() => standalone.stop());
223+
222224
const standaloneSetupTime = Date.now();
223225
console.log('Standalone server started in', standaloneSetupTime - certSetupTime, 'ms');
224226

0 commit comments

Comments
 (0)