Skip to content

Module that provides access to POSIX exec* functions"

License

Notifications You must be signed in to change notification settings

olisto/native-exec

 
 

Repository files navigation

@triggi/native-exec

Build Status

Module that provides access to POSIX exec* functions.

This is a fork of https://github.com/OrKoN/native-exec Inspired by: https://github.com/jprichardson/node-kexec

Installation

requires a C++ compiler installed, most probably.

npm i @triggi/native-exec

Usage

Replace the current process with another one:

var exec = require('@triggi/native-exec');

exec('ls'); // => the process is replaced with ls, which runs and exits

Replace the current process with another one and replace process' env:

var exec = require('@triggi/native-exec');

exec('ls', {
  newEnvKey: newEnvValue,
}); // => the process is replaced with ls -lsa, which runs and exits

Replace the current process with another one, replace process' env and provide arguments:

var exec = require('@triggi/native-exec');

exec('ls', {
  newEnvKey: newEnvValue,
}, '-lsa'); // => the process is replaced with ls, which runs and exits

Use case

If you want to have a bootstrap script written in NodeJS you can use this module to replace the bootstrap process with the process that you actually intend to run specifying env and arguments.

LICENSE

MIT

About

Module that provides access to POSIX exec* functions"

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C++ 51.5%
  • JavaScript 46.3%
  • Python 2.2%