Skip to content

Commit 6d6da97

Browse files
committed
fix timeout setting for ExecCommandOutputWithTimeout
1 parent 830c574 commit 6d6da97

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

util/cmd.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ func execCommandOutputWithTimeout(cmd string, args []string, stdinArgs []string,
8282

8383
// ExecCommandOutputWithTimeout executes ExecCommandOutput with the specified timeout
8484
func ExecCommandOutputWithTimeout(cmd string, args []string, timeout int) (string, int, error) {
85-
return execCommandOutputWithTimeout(cmd, args, []string{}, defaultTimeout)
85+
if timeout == 0 {
86+
timeout = defaultTimeout
87+
}
88+
return execCommandOutputWithTimeout(cmd, args, []string{}, timeout)
8689
}
90+
8791
// ExecCommandOutput returns stdout and stderr in a single string, the return code, and error.
8892
// If the return code is not zero, error will not be nil.
8993
// Stdout and Stderr are dumped to the log at the debug level.

0 commit comments

Comments
 (0)