The execvp
function for Node.js.
import { execvp } from '@alphahydrae/exec';
execvp('ls', ['.']);
console.log(`
This will never print because the executing Node.js
program is replaced by the executed command, keeping
the same process ID and file descriptors.
`);
If you're familiar with Bash's exec
function, this is the same for Node.js.
This package was developed to be used in Node.js scripts that are frontends to execute other commands. For example, a script that would build and execute a complex SSH or Ansible command.
npm i @alphahydrae/exec
OS & Architecture | Node.js 18 | Node.js 20 | Node.js 22 |
---|---|---|---|
macOS x64 | ✅ | ✅ | ✅ |
macOS arm64 | ✅ | ✅ | ✅ |
Linux x64 gnu | ✅ | ✅ | ✅ |
Linux x64 musl | ✅ | ✅ | ✅ |
Linux arm64 gnu | ✅ | ✅ | ✅ |
Linux arm64 musl | ✅ | ✅ | ✅ |
Linux arm gnu | ❌ | ❌ | ❌ |
Android arm64 | ❌ | ❌ | ❌ |
Android armv7 | ❌ | ❌ | ❌ |
FreeBSD x64 | ❌ | ❌ | ❌ |
Windows x64 | ❌ | ❌ | ❌ |
Windows x32 | ❌ | ❌ | ❌ |
Windows arm64 | ❌ | ❌ | ❌ |
The
exec
family of functions is part of the POSIX operating system API, so it will not work on Windows.
This package is a re-implementation of https://github.com/jprichardson/node-kexec in Rust, also inspired by the following conversations:
Also a big thank you to the following Rust projects for making it easy: