Merge pull request #7761 from jepio/iocopy-fix-race

runtime: Fix data race in ioCopy
This commit is contained in:
Jeremi Piotrowski 2023-09-01 09:30:54 +02:00 committed by GitHub
commit bde06758b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,11 +126,11 @@ func ioCopy(shimLog *logrus.Entry, exitch, stdinCloser chan struct{}, tty *ttyIO
p := bufPool.Get().(*[]byte)
defer bufPool.Put(p)
io.CopyBuffer(tty.io.Stdout(), stdoutPipe, *p)
wg.Done()
if tty.io.Stdin() != nil {
// close stdin to make the other routine stop
tty.io.Stdin().Close()
}
wg.Done()
shimLog.Debug("stdout io stream copy exited")
}()
}