refactor(ops/process): add StdioOrRid enum (#14393)

This commit is contained in:
David Sherret 2022-04-26 09:26:05 -04:00 committed by GitHub
parent dc4ab1d934
commit 3c7c586577
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 72 deletions

View file

@ -11,7 +11,6 @@
ArrayPrototypeMap,
ArrayPrototypeSlice,
TypeError,
isNaN,
ObjectEntries,
String,
} = window.__bootstrap.primordials;
@ -95,10 +94,6 @@
}
}
function isRid(arg) {
return !isNaN(arg);
}
function run({
cmd,
cwd = undefined,
@ -120,12 +115,9 @@
env: ObjectEntries(env),
gid,
uid,
stdin: isRid(stdin) ? "" : stdin,
stdout: isRid(stdout) ? "" : stdout,
stderr: isRid(stderr) ? "" : stderr,
stdinRid: isRid(stdin) ? stdin : 0,
stdoutRid: isRid(stdout) ? stdout : 0,
stderrRid: isRid(stderr) ? stderr : 0,
stdin,
stdout,
stderr,
});
return new Process(res);
}