Debian Codegraph @

reexec/reexec_other.go

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