cmd/vulncheck_sandbox: make test portable

Change-Id: I0bb406470b350af941e5d55d131e922ff7980560
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/469216
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
diff --git a/cmd/vulncheck_sandbox/vulncheck_sandbox_test.go b/cmd/vulncheck_sandbox/vulncheck_sandbox_test.go
index 06ba927..87a178d 100644
--- a/cmd/vulncheck_sandbox/vulncheck_sandbox_test.go
+++ b/cmd/vulncheck_sandbox/vulncheck_sandbox_test.go
@@ -46,7 +46,9 @@
 	t.Run("binary", func(t *testing.T) {
 		t.Skip("vulncheck.Binary may not support the Go version")
 		const binary = "testdata/module/vuln"
-		if _, err := exec.Command("/bin/sh", "-c", "cd testdata/module && go build").Output(); err != nil {
+		cmd := exec.Command("go build")
+		cmd.Dir = "testdata/module"
+		if _, err := cmd.Output(); err != nil {
 			t.Fatal(log.IncludeStderr(err))
 		}
 		defer os.Remove(binary)