@typescript/server-replay
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/microsoft/typescript-server-replay#readme", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"license": "MIT", | ||
@@ -32,3 +32,3 @@ "description": "Replay server requests from a file", | ||
"dependencies": { | ||
"@typescript/server-harness": "^0.1.4", | ||
"@typescript/server-harness": "^0.2.0", | ||
"yargs": "^16.2.0" | ||
@@ -35,0 +35,0 @@ }, |
@@ -114,4 +114,8 @@ const sh = require("@typescript/server-harness"); | ||
} | ||
sawExit = sawExit || request.command === "exit"; | ||
requests.push(request); | ||
// Drop exit requests in unattended mode - we need to tear down more explicitly | ||
const isExit = request.command === "exit"; | ||
sawExit = sawExit || isExit; | ||
if (!isExit || !unattended) { | ||
requests.push(request); | ||
} | ||
} | ||
@@ -130,5 +134,4 @@ catch { | ||
const synthesizedExitRequest = { "seq": 999999, "command": "exit" }; | ||
if (!sawExit) { | ||
requests.push(synthesizedExitRequest); | ||
if (!sawExit && !unattended) { | ||
requests.push({ "seq": 999999, "command": "exit" }); | ||
} | ||
@@ -162,5 +165,5 @@ | ||
if (!unattended || !exitRequested || code) { | ||
console.log(`${exitRequested ? "Shut down" :"Exited unexpectedly"}${code ? ` with code ${code}` : ""}`); | ||
console.log(`${exitRequested ? "Shut down" : "Exited unexpectedly"}${code ? ` with code ${code}` : ""}`); | ||
} | ||
if (unattended) { | ||
if (unattended && !exitRequested) { | ||
process.exit(3); | ||
@@ -175,3 +178,3 @@ } | ||
try { | ||
await server.message(synthesizedExitRequest); | ||
await exitOrKillServer(); | ||
} | ||
@@ -194,6 +197,6 @@ catch { | ||
try { | ||
exitRequested = true; | ||
await server.message(synthesizedExitRequest); | ||
await exitOrKillServer(); | ||
} | ||
catch { | ||
// Ignore errors during shutdown | ||
} | ||
@@ -207,2 +210,14 @@ process.exit(5); | ||
} | ||
if (unattended) { | ||
if (!await exitOrKillServer()) { | ||
// Server didn't exit cleanly and had to be killed | ||
process.exit(6); | ||
} | ||
} | ||
async function exitOrKillServer() { | ||
exitRequested = true; // Suppress "exit" event handler | ||
return await server.exitOrKill(5000); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14549
198
+ Added@typescript/server-harness@0.2.1(transitive)
- Removed@typescript/server-harness@0.1.5(transitive)