Skip to content

Commit 8b5ed3c

Browse files
jrickdr2chase
authored andcommitted
runtime: Use doas -n in TestSUID on OpenBSD
This prevents a hang at a su password prompt when running this test on OpenBSD. Fixes #60690. Change-Id: I62d27aa63f225f8247c324b87b5e688319061f4f GitHub-Last-Rev: 217813a GitHub-Pull-Request: #60742 Reviewed-on: https://go-review.googlesource.com/c/go/+/502575 Run-TryBot: David Chase <[email protected]> Reviewed-by: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]>
1 parent 8faa79e commit 8b5ed3c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/security_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ func privesc(command string, args ...string) error {
2727
var cmd *exec.Cmd
2828
if runtime.GOOS == "darwin" {
2929
cmd = exec.CommandContext(ctx, "sudo", append([]string{"-n", command}, args...)...)
30+
} else if runtime.GOOS == "openbsd" {
31+
cmd = exec.CommandContext(ctx, "doas", append([]string{"-n", command}, args...)...)
3032
} else {
3133
cmd = exec.CommandContext(ctx, "su", highPrivUser, "-c", fmt.Sprintf("%s %s", command, strings.Join(args, " ")))
3234
}

0 commit comments

Comments
 (0)