Skip to content

Commit 8a83848

Browse files
dbaranchukborzunov
andauthored
Ignore SIGINT (#19)
If someone uses hivemind from the Python interactive console/Jupyter notebooks, the keyboard interrupts (Ctrl+C) are propagated to children processes including the libp2p daemon and the daemon gets killed. This PR fixes this behavior, so the daemon continues to run in background. Co-authored-by: Aleksandr Borzunov <borzunov.alexander@gmail.com>
1 parent eba9b65 commit 8a83848

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

p2pd/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"log"
1111
"net/http"
1212
"os"
13+
"os/signal"
1314
"strings"
1415
"time"
1516

@@ -399,6 +400,8 @@ func main() {
399400
go func() { log.Println(http.ListenAndServe(c.MetricsAddress, nil)) }()
400401
}
401402

403+
signal.Ignore(os.Interrupt)
404+
402405
if err := d.Serve(); err != nil {
403406
log.Fatal(err)
404407
}

0 commit comments

Comments
 (0)