air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
16.53k stars 779 forks source link

air doesn't handle SIGHUP #437

Closed newhook closed 10 months ago

newhook commented 1 year ago

This means if the controlling terminal dies, or is disconnected air stops but any forked executable hangs around.

diff --git a/main.go b/main.go
index 0b785ea..4635ae3 100644
--- a/main.go
+++ b/main.go
@@ -59,7 +59,7 @@ func main() {
                fmt.Println("[debug] mode")
        }
        sigs := make(chan os.Signal, 1)
-       signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
+       signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)

        var err error
        cfg, err := runner.InitConfig(cfgPath)

This small change fixes that problem.