Debian Codegraph @

reexec/reexec_linux.go

raw symbols SCIP
1 package reexec
2
3 import (
4 "context"
5 "os/exec"
6 "syscall"
7 )
8
9 func command(args ...string) *exec.Cmd {
10 // We try to stay close to exec.Command's behavior, but after
11 // constructing the cmd, we remove "Self()" from cmd.Args, which
12 // is prepended by exec.Command.
13 cmd := exec.Command(Self(), args...)
14 cmd.Args = cmd.Args[1:]
15 cmd.SysProcAttr = &syscall.SysProcAttr{
16 Pdeathsig: syscall.SIGTERM,
17 }
18 return cmd
19 }
20
21 func commandContext(ctx context.Context, args ...string) *exec.Cmd {
22 // We try to stay close to exec.Command's behavior, but after
23 // constructing the cmd, we remove "Self()" from cmd.Args, which
24 // is prepended by exec.Command.
25 cmd := exec.CommandContext(ctx, Self(), args...)
26 cmd.Args = cmd.Args[1:]
27 cmd.SysProcAttr = &syscall.SysProcAttr{
28 Pdeathsig: syscall.SIGTERM,
29 }
30 return cmd
31 }