# kexec

> Replace your Node.js process with another process. Like Ruby exec.

Latest version **3.0.0** (published 2016-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install kexec
pnpm add kexec
yarn add kexec
bun add kexec
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2016-09-11 |
| First published | 2011-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 51 |
| Author | JP Richardson |
| Maintainers | smblott, jprichardson |
| Keywords | exec, spawn, process, kexec |

## Links

- npm: https://www.npmjs.com/package/kexec
- Repository: https://github.com/jprichardson/node-kexec
- Issues: https://github.com/jprichardson/node-kexec/issues
- npm.io page: https://npm.io/package/kexec

## Dependencies (1)

- [nan](https://npm.io/package/nan.md) ^2.4.0

## Recent versions

- 3.0.0 (latest) — 2016-09-11
- 2.0.2 — 2015-11-28
- 2.0.1 — 2015-11-25
- 2.0.0 — 2015-11-25
- 1.3.0 — 2015-10-20
- 1.2.0 — 2015-02-09
- 1.1.1 — 2015-01-26
- 1.1.0 — 2015-01-20
- 1.0.0 — 2014-12-30
- 0.2.0 — 2014-01-25
- 0.1.2 — 2014-01-25
- 0.1.1 — 2012-09-19
- 0.1.0 — 2012-09-19
- 0.0.3 — 2012-01-09
- 0.0.2 — 2012-01-06
- … 1 more at https://npm.io/package/kexec/versions

## README

Node.js - kexec
===============

[![npm Package](https://img.shields.io/npm/v/kexec.svg?style=flat-square)](https://www.npmjs.org/package/kexec)
[![build status](https://api.travis-ci.org/jprichardson/node-kexec.svg)](http://travis-ci.org/jprichardson/node-kexec)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](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

---
_Source: https://npm.io/package/kexec · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
