Skip to content

Commit

Permalink
A few more minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Aug 30, 2023
1 parent e4379d2 commit f70cc2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.tsdk": "node_modules\\typescript\\lib",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
14 changes: 11 additions & 3 deletions src/test/util/test-rig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ export class WireitTestRig extends FilesystemTestRig {
override async cleanup(): Promise<void> {
await Promise.all(this._commands.map((command) => command.close()));
for (const child of this._activeChildProcesses) {
child.kill();
// Force kill child processes, because we're cleaning up the test rig
// at the end of the test, and if any are still running then the test
// has probably failed from timeout. If the process is hung, we'll
// already see that from the timeout.
child.kill({force: true});
await child.exit;
}
await super.cleanup();
Expand Down Expand Up @@ -299,7 +303,7 @@ class ExecResult {
/**
* Kill the child process.
*/
kill(): void {
kill({force} = {force: false}): void {
if (!this.running) {
throw new Error("Can't kill child process because it is not running");
}
Expand All @@ -318,7 +322,11 @@ class ExecResult {
// own process group. Passing the negative of the child's pid kills all
// processes in the group (without the negative only the leader "sh"
// process would be killed).
process.kill(-this._child.pid, 'SIGINT');
if (force) {
process.kill(-this._child.pid, 9);
} else {
process.kill(-this._child.pid, 'SIGINT');
}
}
}

Expand Down

0 comments on commit f70cc2a

Please sign in to comment.