Improve process termination handling in smoke tests (#245434)

* Improve process termination handling in smoke tests

* .
This commit is contained in:
Benjamin Pasero
2025-04-03 12:31:04 +02:00
committed by GitHub
parent 62d199b834
commit a8c6b3fd45

View File

@@ -208,10 +208,17 @@ export class Code {
private kill(pid: number): void {
try {
this.logger.log(`Smoke test exit(): Trying to SIGTERM process: ${pid}`);
process.kill(pid, 0); // throws an exception if the process doesn't exist anymore.
} catch (e) {
this.logger.log('Smoke test kill(): returning early because process does not exist anymore');
return;
}
try {
this.logger.log(`Smoke test kill(): Trying to SIGTERM process: ${pid}`);
process.kill(pid);
} catch (e) {
this.logger.log('Smoke test exit(): SIGTERM failed', e);
this.logger.log('Smoke test kill(): SIGTERM failed', e);
}
}