zx
zx copied to clipboard
kill() should only resolve when the process exits
Expected Behavior
kill().then(() => { console.log('expect this to be called only when process exist'); })
Actual Behavior
kill().then(() => { console.log('not clear when this is called, but the process is still up'); })
Specifications
- Version: v7.2.1
- Platform: macOS
Something like this https://github.com/gajus/turbowatch/commit/f9966be788c21c60fb7d12af6c1543e0724449a9
Up to date implementation is here https://github.com/gajus/turbowatch/blob/main/src/killPsTree.ts
The current impl just emits resolved when all associated processes have received the signal. Perhaps, sometimes we should wait for all these signals to be processed, but status polling via cp.spawn requires configurable timings, debounces, etc. I suggest providing this externally if necessary: $.kill = async () => {}