diff options
author | Mura Li <typeless@users.noreply.github.com> | 2019-12-13 17:03:38 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-13 17:03:38 +0800 |
commit | 6e6936d73d00cfb0bb6131b1b919807e3d4b1f73 (patch) | |
tree | 981cba41912bcd4cc4b715f9bf39b5d94df7c2e9 /modules/git/command.go | |
parent | 39db99a5956f3c41ceba6b9afe452af52a369db0 (diff) | |
download | gitea-6e6936d73d00cfb0bb6131b1b919807e3d4b1f73.tar.gz gitea-6e6936d73d00cfb0bb6131b1b919807e3d4b1f73.zip |
Fix nondeterministic behavior (#9341)
The underlying implementation of os.exec uses channels and goroutines.
It is possible to have time-variant error values returned from Cmd.Wait
depending on which comes first.
Also, the git subcommand and options should be separated tokens.
Fixes a flaky test in modules/git/command_test.go
Diffstat (limited to 'modules/git/command.go')
-rw-r--r-- | modules/git/command.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/git/command.go b/modules/git/command.go index f01db2e1d8..33143dbd75 100644 --- a/modules/git/command.go +++ b/modules/git/command.go @@ -138,7 +138,7 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time. fn(ctx, cancel) } - if err := cmd.Wait(); err != nil { + if err := cmd.Wait(); err != nil && ctx.Err() != context.DeadlineExceeded { return err } |