Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Set default command execution timeout as changable #104

Merged
merged 2 commits into from
Jan 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import (
var (
// GlobalCommandArgs global command args for external package setting
GlobalCommandArgs []string

// DefaultCommandExecutionTimeout default command execution timeout duration
DefaultCommandExecutionTimeout = 60 * time.Second
)

// Command represents a command with its subcommands or arguments.
Expand Down Expand Up @@ -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 {
Expand Down