1
0
mirror of https://github.com/go-gitea/git.git synced 2026-02-05 06:45:03 +01:00

Set default command execution timeout as changable (#104)

* set default command execution timeout as changable

* fix lint
This commit is contained in:
Lunny Xiao
2018-01-06 21:10:22 -06:00
committed by Bo-Yi Wu
parent a34aca91dc
commit 2c3dc95a96

View File

@@ -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.
@@ -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 {