mirror of
https://github.com/go-gitea/git.git
synced 2026-02-05 06:45:03 +01:00
improve log and clone repo command
This commit is contained in:
12
command.go
12
command.go
@@ -122,8 +122,18 @@ func (c *Command) RunInDir(dir string) (string, error) {
|
||||
return string(stdout), nil
|
||||
}
|
||||
|
||||
// RunTimeout executes the command in defualt working directory with given timeout,
|
||||
// and returns stdout in string and error (combined with stderr).
|
||||
func (c *Command) RunTimeout(timeout time.Duration) (string, error) {
|
||||
stdout, err := c.RunInDirTimeout(timeout, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(stdout), nil
|
||||
}
|
||||
|
||||
// Run executes the command in defualt working directory
|
||||
// and returns stdout in string and error (combined with stderr).
|
||||
func (c *Command) Run() (string, error) {
|
||||
return c.RunInDir("")
|
||||
return c.RunTimeout(-1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user