From 9345b250fa5117295da6a1864b8ce6a215b58c37 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 6 Jan 2018 20:00:02 +0800 Subject: [PATCH 1/2] set default command execution timeout as changable --- command.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command.go b/command.go index 06722c213..9098a6822 100644 --- a/command.go +++ b/command.go @@ -17,6 +17,9 @@ import ( var ( // GlobalCommandArgs global command args for external package setting GlobalCommandArgs []string + + // Default command execution timeout duration + DefaultCommandExecutionTimeout = 60 * time.Second ) // Command represents a command with its subcommands or arguments. @@ -50,7 +53,7 @@ func (c *Command) AddArguments(args ...string) *Command { // it pipes stdout and stderr to given io.Writer. func (c *Command) RunInDirTimeoutPipeline(timeout time.Duration, dir string, stdout, stderr io.Writer) error { if timeout == -1 { - timeout = 60 * time.Second + timeout = DefaultCommandExecutionTimeout } if len(dir) == 0 { From 7b1ddc4bb9f188759d22ff4d7f20ab29cf3776c2 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 6 Jan 2018 20:14:47 +0800 Subject: [PATCH 2/2] fix lint --- command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command.go b/command.go index 9098a6822..8ca99fd6d 100644 --- a/command.go +++ b/command.go @@ -18,7 +18,7 @@ var ( // GlobalCommandArgs global command args for external package setting GlobalCommandArgs []string - // Default command execution timeout duration + // DefaultCommandExecutionTimeout default command execution timeout duration DefaultCommandExecutionTimeout = 60 * time.Second )