-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement process.exit(...) in the runtime
- Loading branch information
Showing
7 changed files
with
92 additions
and
0 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
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,26 @@ | ||
import { rejects, ok } from 'assert'; | ||
|
||
let called = false; | ||
|
||
export const test = { | ||
async test(_, env) { | ||
// We don't really have a way to verifying that the correct log messages | ||
// we emitted. For now, we need to manually check the log out, and here | ||
// we check only that we received an internal error and that no other | ||
// lines of code ran after the process.exit call. | ||
await rejects(env.subrequest.fetch('http://example.org'), { | ||
message: /^The Node.js process.exit/, | ||
}); | ||
ok(!called); | ||
}, | ||
}; | ||
|
||
export default { | ||
async fetch() { | ||
try { | ||
process.exit(123); | ||
} finally { | ||
called = true; | ||
} | ||
}, | ||
}; |
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,18 @@ | ||
using Workerd = import "/workerd/workerd.capnp"; | ||
|
||
const unitTests :Workerd.Config = ( | ||
services = [ | ||
( name = "process-exit-test", | ||
worker = ( | ||
modules = [ | ||
(name = "worker", esModule = embed "process-exit-test.js") | ||
], | ||
compatibilityDate = "2024-10-01", | ||
compatibilityFlags = ["nodejs_compat"], | ||
bindings = [ | ||
(name = "subrequest", service = "process-exit-test") | ||
] | ||
) | ||
), | ||
], | ||
); |
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