spawn-command-with-kill

Adds cross-platform `kill` function to spawn-command processes

MIT 3 个版本
安装
npm install spawn-command-with-kill
yarn add spawn-command-with-kill
pnpm add spawn-command-with-kill
bun add spawn-command-with-kill
README

spawn-command-with-kill

Adds cross-platform kill function to spawn-command processes

Build Status Code Coverage Dependencies version downloads MIT License

All Contributors PRs Welcome Donate Code of Conduct Roadmap Examples

Watch on GitHub Star on GitHub Tweet

The problem

spawn-command is a cross platform solution to node's spawn. However, it doesn't provide a mechanism for "killing" the process after it's begun (in a cross platform manner).

This solution

This solution provides a kill function on the child returned from spawn which will kill the corresponding process when invoked. It does not work with spawn.sync as the process will be finished before your code could run anyway.

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

npm install --save spawn-command-with-kill

Usage

const spawn = require('spawn-command-with-kill')
const child = spawn('webpack')
child.kill() // <-- that's the ✨ magic ✨ extra function

Inspiration

Big thank you goes to @mysticatea for his original work on npm-run-all from which this project was derived.

Other Solutions

There's a version of this module for cross-spawn called cross-spawn-with-kill.

Contributors

Thanks goes to these people (emoji key):


Kent C. Dodds

💻 📖 🚇 ⚠️

Toru Nagashima

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

LICENSE

MIT

版本列表
1.0.2 2018-11-29
1.0.1 2018-11-29
1.0.0 2016-09-03