fix e2e profile passing args

This commit is contained in:
Gavin Nishizawa 2023-04-28 20:27:06 -07:00
parent 8fa824926c
commit 66da318016
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -71,7 +71,18 @@ func main() {
ctx := log.Stderr(context.Background())
ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
cmd := exec.CommandContext(ctx, "go", "test", testDir, testMatchString, cpuProfileStr, memProfileStr, vString)
// don't want to pass empty args to CommandContext
args := []string{"test", testDir, testMatchString}
if cpuProfileStr != "" {
args = append(args, cpuProfileStr)
}
if memProfileStr != "" {
args = append(args, memProfileStr)
}
if vString != "" {
args = append(args, vString)
}
cmd := exec.CommandContext(ctx, "go", args...)
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, "FORCE_COLOR=1")
cmd.Env = append(cmd.Env, "DEBUG=1")