Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent dangling cat-file calls (goroutine alternative) (#19454) #19466

Merged
merged 1 commit into from
Apr 22, 2022

Commits on Apr 22, 2022

  1. Prevent dangling cat-file calls (goroutine alternative) (go-gitea#19454)

    If an `os/exec.Command` is passed non `*os.File` as an input/output, go
    will create `os.Pipe`s and wait for their closure in `cmd.Wait()`.  If
    the code following this is responsible for closing `io.Pipe`s or other
    handlers then on process death from context cancellation the `Wait` can
    hang.
    
    There are two possible solutions:
    
    1. use `os.Pipe` as the input/output as `cmd.Wait` does not wait for these.
    2. create a goroutine waiting on the context cancellation that will close the inputs.
    
    This PR provides the second option - which is a simpler change that can
    be more easily backported.
    
    Closes go-gitea#19448
    
    Signed-off-by: Andrew Thornton <[email protected]>
    zeripath authored and 6543 committed Apr 22, 2022
    Configuration menu
    Copy the full SHA
    5092931 View commit details
    Browse the repository at this point in the history