sindresorhus/execa

Ability to kill all descendents of the child process

クローズ

#96 opened on 2017/06/23

 (14 件のコメント) (13 件のリアクション) (0 人の担当者)JavaScript (219 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (6,091 個のスター)
PR merge metrics
 (平均マージ 6d 18h) (30d で 6 merged PRs)

説明

When I'm working with child processes, I sometimes end up with detached processes running indefinitely after I've killed the direct child, which can lead to blocked ports and memory leaks.

I sometimes fix this by using a module like ps-tree to find out all the descendants PIDs, and then send all of them a kill command, but it feels messy. It would be nice if execa could provide a clean, cross-platform API for this.

Maybe something like this:

const execa = require('execa');

const child = execa('./something');

// ...

child.killTree().then(() => {
  console.log('all dead!');
});

コントリビューターガイド