mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 07:44:48 -05:00
0dec9b4381
Fixes "op_set_exit_code" by sharing a single "Arc" between all workers (via "op state") instead of having a "global" value stored in "deno_runtime" crate. As a consequence setting an exit code is always scoped to a tree of workers, instead of being overridable if there are multiple worker tree (like in "deno test --jobs" subcommand). Refactored "cli/main.rs" functions to return "Result<i32, AnyError>" instead of "Result<(), AnyError>" so they can return exit code.
13 lines
329 B
TypeScript
13 lines
329 B
TypeScript
import { deferred } from "../../../test_util/std/async/deferred.ts";
|
|
|
|
const worker = new Worker(
|
|
new URL("set_exit_code_worker.js", import.meta.url).href,
|
|
{ type: "module", deno: { namespace: true } },
|
|
);
|
|
|
|
const promise1 = deferred();
|
|
worker.onmessage = (_e) => {
|
|
promise1.resolve();
|
|
};
|
|
await promise1;
|
|
worker.terminate();
|