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/execThe
execfamily 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:
