From d34dcaca3753237cae310dd5d755eb5c85bb624e Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Tue, 24 Oct 2023 13:03:22 -0700 Subject: [PATCH] Propagate exit code for nsfakeroot command --- cmd/nsfakeroot/fakeroot.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/nsfakeroot/fakeroot.go b/cmd/nsfakeroot/fakeroot.go index 1929728..aaf531c 100644 --- a/cmd/nsfakeroot/fakeroot.go +++ b/cmd/nsfakeroot/fakeroot.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "os/exec" "lure.sh/fakeroot" "lure.sh/fakeroot/loginshell" @@ -46,7 +47,9 @@ func main() { c.Stderr = os.Stderr err = c.Run() - if err != nil { + if err, ok := err.(*exec.ExitError); ok { + os.Exit(err.ExitCode()) + } else if err != nil { log.Fatalln(err) } }