Skip to content

Adopt the new server-harness awaitable kill #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@octokit/rest": "^16.43.2",
"@typescript/github-link": "^0.2.1",
"@typescript/server-harness": "^0.2.1",
"@typescript/server-harness": "^0.3.0",
"@typescript/server-replay": "^0.2.6",
"glob": "^7.2.3",
"json5": "^2.2.1",
Expand Down
15 changes: 4 additions & 11 deletions src/utils/exerciseServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,8 @@ async function exerciseServerWorker(testDir: string, tsserverPath: string, repla
"--expose-gc",
]);

process.once("SIGTERM", () => {
exitExpected = true;
server.kill();
// This is a sneaky way to invoke node's default SIGTERM handler
process.kill(process.pid, "SIGTERM");
});

let loadedNewProject = false;
server.on("event", (e: any) => {
server.on("event", async (e: any) => {
switch (e.event) {
case "projectLoadingFinish":
loadedNewProject = true;
Expand All @@ -105,7 +98,7 @@ async function exerciseServerWorker(testDir: string, tsserverPath: string, repla
const languageServiceDisabledProject = e.body.projectName ? path.normalize(e.body.projectName) : "unknown project";
console.error(`Language service disabled for ${languageServiceDisabledProject}`);
exitExpected = true;
server.kill();
await server.kill();
process.exit(EXIT_LANGUAGE_SERVICE_DISABLED);
}
break;
Expand Down Expand Up @@ -366,7 +359,7 @@ async function exerciseServerWorker(testDir: string, tsserverPath: string, repla
console.error(e);

exitExpected = true;
server.kill();
await server.kill();
process.exit(EXIT_UNHANDLED_EXCEPTION);
}

Expand Down Expand Up @@ -417,7 +410,7 @@ ${JSON.stringify(response, undefined, 2)}`);
console.log(JSON.stringify(response));

exitExpected = true;
server.kill();
await server.kill();
process.exit(EXIT_SERVER_ERROR);
}

Expand Down