Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions internal/vminit/process/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,26 @@ type processIO struct {
}

func (p *processIO) Close() error {
var result []error
if p.io != nil {
return p.io.Close()
if err := p.io.Close(); err != nil {
result = append(result, err)
}
}

// Close the stream connections here so EOF is propagated immediately.
// On the normal exit path, the copyPipes goroutines close the streams themselves
// once the runc pipes EOF, but if the exec process fails to start, copyPipes is
// never reached and this Close is the only cleanup. Streams already closed by
// copyPipes return ErrClosed which callers ignore.
for i, s := range p.streams {
if s != nil && (i != 2 || s != p.streams[1]) {
s.Close()
if err := s.Close(); err != nil {
result = append(result, err)
}
}
}
return nil
return errors.Join(result...)
Comment on lines 67 to +87
}

func (p *processIO) IO() runc.IO {
Expand Down
Loading