mirror of https://github.com/golang/go.git
runtime: Use doas -n in TestSUID on OpenBSD
This prevents a hang at a su password prompt when running this test on OpenBSD.
This commit is contained in:
parent
5e9b76fe2a
commit
217813a4d5
|
|
@ -27,6 +27,8 @@ func privesc(command string, args ...string) error {
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
cmd = exec.CommandContext(ctx, "sudo", append([]string{"-n", command}, args...)...)
|
cmd = exec.CommandContext(ctx, "sudo", append([]string{"-n", command}, args...)...)
|
||||||
|
} else if runtime.GOOS == "openbsd" {
|
||||||
|
cmd = exec.CommandContext(ctx, "doas", append([]string{"-n", command}, args...)...)
|
||||||
} else {
|
} else {
|
||||||
cmd = exec.CommandContext(ctx, "su", highPrivUser, "-c", fmt.Sprintf("%s %s", command, strings.Join(args, " ")))
|
cmd = exec.CommandContext(ctx, "su", highPrivUser, "-c", fmt.Sprintf("%s %s", command, strings.Join(args, " ")))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue