atom-community / atom-community/atom-script

Terminating go script doesn't kill child processes

Open
#453 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

Using a basic golang script, such as the one below that serves a simple webpage, is not properly killed using the Mac OS X version of Atom and atom-script. Assuming the name of the script is 'hello.go', when the script is run using atom-script, you can see that both a 'go' and a 'hello' process are actively running. When the script is terminated using 'Ctrl-C', only the 'go' process is killed and not its children processes, such as 'hello'. This is problematic, as it requires a manual process kill of all children process before the script can be re-run. If the script is run from the command line using 'go run' it kills all processes when 'Ctrl-C' is issued. I'm curious how the process is being terminated? Through a standard SIGTERM?

``` go
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)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.