From 5eb13b6ba60c3a70cd247ffaa473d3b77fa30d97 Mon Sep 17 00:00:00 2001 From: Brad Davidson Date: Mon, 1 Nov 2021 12:37:40 -0700 Subject: [PATCH] Fix log/reap reexec Signed-off-by: Brad Davidson --- pkg/cli/cmds/log_linux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/cli/cmds/log_linux.go b/pkg/cli/cmds/log_linux.go index 4a95cb012d..ea7f374c64 100644 --- a/pkg/cli/cmds/log_linux.go +++ b/pkg/cli/cmds/log_linux.go @@ -58,7 +58,7 @@ func forkIfLoggingOrReaping() error { args := append([]string{version.Program}, os.Args[1:]...) env := append(os.Environ(), "_K3S_LOG_REEXEC_=true", "NOTIFY_SOCKET=") cmd := &exec.Cmd{ - Path: os.Args[0], + Path: "/proc/self/exe", Dir: pwd, Args: args, Env: env, @@ -66,7 +66,7 @@ func forkIfLoggingOrReaping() error { Stdout: stdout, Stderr: stderr, SysProcAttr: &syscall.SysProcAttr{ - Setsid: true, + Pdeathsig: unix.SIGTERM, }, } if err := cmd.Start(); err != nil {