From 217813a4d57a97954449d13c24a465aa0af41da3 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 12 Jun 2023 16:01:10 +0000 Subject: [PATCH] runtime: Use doas -n in TestSUID on OpenBSD This prevents a hang at a su password prompt when running this test on OpenBSD. --- src/runtime/security_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/security_test.go b/src/runtime/security_test.go index 1d304113d6..5cd90f9d1f 100644 --- a/src/runtime/security_test.go +++ b/src/runtime/security_test.go @@ -27,6 +27,8 @@ func privesc(command string, args ...string) error { var cmd *exec.Cmd if runtime.GOOS == "darwin" { 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 { cmd = exec.CommandContext(ctx, "su", highPrivUser, "-c", fmt.Sprintf("%s %s", command, strings.Join(args, " "))) }