Skip to content

Commit

Permalink
Make git batch operations use parent context timeout instead of defau…
Browse files Browse the repository at this point in the history
…lt timeout (#26325)

Fix #26064

Some git commands should use parent context, otherwise it would exit too
early (by the default timeout, 10m), and the "cmd.Wait" waits till the
pipes are closed.
  • Loading branch information
wxiaoguang authored Aug 4, 2023
1 parent 68c652d commit 2de0752
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/git/batch_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func CatFileBatchCheck(ctx context.Context, repoPath string) (WriteCloserError,
Stdin: batchStdinReader,
Stdout: batchStdoutWriter,
Stderr: &stderr,

UseContextTimeout: true,
})
if err != nil {
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
Expand Down Expand Up @@ -124,6 +126,8 @@ func CatFileBatch(ctx context.Context, repoPath string) (WriteCloserError, *bufi
Stdin: batchStdinReader,
Stdout: batchStdoutWriter,
Stderr: &stderr,

UseContextTimeout: true,
})
if err != nil {
_ = batchStdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
Expand Down

0 comments on commit 2de0752

Please sign in to comment.