atom-runner icon indicating copy to clipboard operation
atom-runner copied to clipboard

Use tree-kill to properly stop the whole process tree

Open ghost opened this issue 9 years ago • 2 comments

ChildProcess.kill() doesn't stop forked subprocesses. This commit uses tree-kill to properly handle forked subprocesses on all platforms.

ghost avatar Dec 25 '15 15:12 ghost

Shouldn't the OS be reaping subprocesses? Can you show a scenario where the forked subprocesses remain around as zombies?

lsegal avatar Dec 28 '15 22:12 lsegal

Hi @lsegal,

yes, there are plenty of situations where subprocesses won't get killed by child_process. The ones I am struggling with are more complex python scripts using asyncio. A simple one would be a basic go server like this.

package main

import (
    "net/http"
)

func handler(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello World!"))
}

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8080", nil)
}

ghost avatar Dec 30 '15 09:12 ghost