summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/process.ts
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-09-12 12:24:58 -0700
committerGitHub <noreply@github.com>2024-09-12 19:24:58 +0000
commit18b89d948dcb849c4dc577478794c3d5fb23b597 (patch)
tree9945567e4b53dc50d2a61a3149b51edf97c05839 /ext/node/polyfills/process.ts
parent3f15e300625723df10c564c4e29ec276288a931b (diff)
fix(ext/node): Implement detached option in `child_process` (#25218)
Fixes https://github.com/denoland/deno/issues/25193.
Diffstat (limited to 'ext/node/polyfills/process.ts')
-rw-r--r--ext/node/polyfills/process.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts
index f84255814..d7e21b657 100644
--- a/ext/node/polyfills/process.ts
+++ b/ext/node/polyfills/process.ts
@@ -267,9 +267,11 @@ memoryUsage.rss = function (): number {
// Returns a negative error code than can be recognized by errnoException
function _kill(pid: number, sig: number): number {
+ const maybeMapErrno = (res: number) =>
+ res === 0 ? res : uv.mapSysErrnoToUvErrno(res);
// signal 0 does not exist in constants.os.signals, thats why it have to be handled explicitly
if (sig === 0) {
- return op_node_process_kill(pid, 0);
+ return maybeMapErrno(op_node_process_kill(pid, 0));
}
const maybeSignal = Object.entries(constants.os.signals).find((
[_, numericCode],
@@ -278,7 +280,7 @@ function _kill(pid: number, sig: number): number {
if (!maybeSignal) {
return uv.codeMap.get("EINVAL");
}
- return op_node_process_kill(pid, sig);
+ return maybeMapErrno(op_node_process_kill(pid, sig));
}
export function dlopen(module, filename, _flags) {