https://github.com/meteor/node-kexec
Node.js exec function to replace running process; like Ruby's exec.
https://github.com/meteor/node-kexec
Last synced: 5 months ago
JSON representation
Node.js exec function to replace running process; like Ruby's exec.
- Host: GitHub
- URL: https://github.com/meteor/node-kexec
- Owner: meteor
- License: mit
- Fork: true (jprichardson/node-kexec)
- Created: 2019-05-09T16:34:31.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-17T13:31:42.000Z (about 4 years ago)
- Last Synced: 2024-09-25T13:04:46.310Z (9 months ago)
- Language: C++
- Homepage:
- Size: 42 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Node.js - kexec
===============[](https://www.npmjs.org/package/kexec)
[](http://travis-ci.org/jprichardson/node-kexec)
[](http://standardjs.com/)This module causes your current Node.js process to be replaced by the process invoked by the parameter of this function. It's like the Ruby exec function. It currently does not work on Windows.
Fully compatible with Node.js version v0.10 and v0.11.
Usage
-----```js
var kexec = require('kexec')kexec('top') //your process now becomes top, can also accept parameters in one string
``````javascript
var kexec = require('kexec')kexec('du', [ '-sh', '/etc/fstab' ]) //your process now becomes du, with the arguments indicated
```Details
-------`kexec` can be called in either of two ways, as indicated by the examples, above.
With one argument `arg`, that argument must be a string. The resulting system
call is:execvp("/bin/sh", [ "/bin/sh", "-c", arg, 0 ]);
With two arguments, the first (`cmd`) must be a string, and the second (`args`) an array of strings. The resulting
system call is:execvp(cmd, [ cmd, args[0], args[1], ..., 0 ]);
In the first case, the command is subject to shell parsing, and shell meta
characters retain their special meanings. In the second case, the arguments
are passed directly to `execvp`, without an intervening shell.License
-------(The MIT License)
Copyright (c) 2011-2015 JP Richardson