Skip to content

Commit

Permalink
Set default command execution timeout as changable (go-gitea#104)
Browse files Browse the repository at this point in the history
* set default command execution timeout as changable

* fix lint
  • Loading branch information
lunny authored and appleboy committed Jan 7, 2018
1 parent a34aca9 commit 2c3dc95
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 2c3dc95

Please sign in to comment.