]> ruderich.org/simon Gitweb - linux-network-namespace-labs/linux-network-namespace-labs.git/commitdiff
Don't abort on "down" when process doesn't exist
authorSimon Ruderich <simon@ruderich.org>
Fri, 15 Nov 2024 08:00:44 +0000 (09:00 +0100)
committerSimon Ruderich <simon@ruderich.org>
Fri, 15 Nov 2024 08:04:03 +0000 (09:04 +0100)
setup.go

index e49413d6ee6477cb30f11aaa17ce79bd7ffeae7b..bbf42f4207c89814b2c32063b6ab76a5d8624cf3 100644 (file)
--- a/setup.go
+++ b/setup.go
@@ -190,6 +190,11 @@ func netnsKillPids(netns string) {
                log.Printf("  Killing old PID %d", x)
                err := syscall.Kill(x, syscall.SIGTERM)
                if err != nil {
+                       if err == syscall.ESRCH {
+                               // When running multiple processes some might be already dead
+                               log.Printf("failed to kill %d: %v (ignoring)", x, err)
+                               continue
+                       }
                        log.Fatalf("failed to kill %d: %v", x, err)
                }
                // Also try SIGHUP to terminate shells which ignore SIGTERM