-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exiting of a hanging sub-command (#115)
* Using a Set to store cleanup tasks and remove command killing on "close" * Adding a hanging command test * Adding a test ensuring the killing of sub-process when interrupting the CLI * Filtering stacks server-side * Waiting for cli to close * Fixing "interrupted" and "hanging" tests
- Loading branch information
1 parent
2e11272
commit 1ec998e
Showing
8 changed files
with
170 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Client } from "mocha-remote-client"; | ||
|
||
import assert from "node:assert"; | ||
import fs from "node:fs"; | ||
|
||
new Client({ | ||
tests({ outFile, endlessLoop }) { | ||
assert(typeof outFile === "string", "Expected a 'outFile' in context"); | ||
assert(fs.existsSync(outFile) === false, `Expected '${outFile}' to not exist`); | ||
fs.writeFileSync(outFile, JSON.stringify({ pid: process.pid }), "utf8"); | ||
|
||
if (endlessLoop) { | ||
// eslint-disable-next-line no-constant-condition | ||
while (true) { | ||
// Useful to simulate a process that cannot be exited gracefully | ||
} | ||
} | ||
|
||
it("succeeds but doesn't exit", () => {}); | ||
} | ||
}); | ||
|
||
// Do a long timeout to prevent an exit | ||
setTimeout(() => {}, 60 * 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters