@jcbhmr/exec
v1.0.1
Published
🐧 Ergonomic exec(3) for JavaScript
Readme
exec(3) for JavaScript
🐧 Ergonomic exec(3) for JavaScript
// Replaces the current process with a new one.
exec("node", ["--version"], {
cwd: "/home/someone_else/projects",
env: { HELLO: "WORLD" },
uid: 1234,
});🐧 Works on Linux, macOS, BSDs, and more
🛑 Does not work on Windows
👶 Same arguments as node:child_process spawn
Installation
npm install @jcbhmr/exec⚠️ This package requires a Unix-like OS (Linux, macOS, etc.). Windows is not supported. For an isomorphic cross-platform solution, consider using @jcbhmr/cross-exec.
Usage
// Unix-like operating systems ONLY.
import exec from "@jcbhmr/exec";
exec("node", ["--version"]);Development
If you're on Windows you must use WSL to develop this package.
TODOs
- Implement fd rearrangement according to the stdio options. Right now it just inherits.
- When Deno adds
process.execve()support, use that instead of FFI. https://github.com/denoland/deno/issues/29017 - When Bun adds
process.execve()support, use that instead of FFI.
