6543 1d665da32f
Prevent dangling cat-file calls (goroutine alternative) (#19454) (#19466)
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 #19448

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: zeripath <art27@cantab.net>
2022-04-22 16:58:50 +01:00
..
2022-01-10 17:32:37 +08:00
2021-12-20 04:41:31 +00:00
2021-12-06 00:24:57 +08:00
2022-01-10 17:32:37 +08:00
2022-01-10 17:32:37 +08:00
2022-01-14 16:03:31 +01:00
2021-12-20 04:41:31 +00:00
2022-01-02 21:12:35 +08:00
2022-01-10 17:32:37 +08:00
2022-01-10 17:32:37 +08:00
2021-12-20 04:41:31 +00:00
2022-01-02 21:12:35 +08:00
2022-01-10 17:32:37 +08:00
2021-12-20 04:41:31 +00:00
2021-10-13 22:50:23 -04:00
2021-12-20 04:41:31 +00:00