mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
@@ -27,8 +27,8 @@ type tty struct {
|
||||
|
||||
func (t *tty) copyIO(w io.Writer, r io.ReadCloser) {
|
||||
defer t.wg.Done()
|
||||
io.Copy(w, r)
|
||||
r.Close()
|
||||
_, _ = io.Copy(w, r)
|
||||
_ = r.Close()
|
||||
}
|
||||
|
||||
// setup pipes for the process so that advanced features like c/r are able to easily checkpoint
|
||||
@@ -56,8 +56,8 @@ func setupProcessPipes(p *libcontainer.Process, rootuid, rootgid int) (*tty, err
|
||||
}
|
||||
}
|
||||
go func() {
|
||||
io.Copy(i.Stdin, os.Stdin)
|
||||
i.Stdin.Close()
|
||||
_, _ = io.Copy(i.Stdin, os.Stdin)
|
||||
_ = i.Stdin.Close()
|
||||
}()
|
||||
t.wg.Add(2)
|
||||
go t.copyIO(os.Stdout, i.Stdout)
|
||||
@@ -126,11 +126,11 @@ func (t *tty) recvtty(process *libcontainer.Process, socket *os.File) (Err error
|
||||
}
|
||||
defer func() {
|
||||
if Err != nil {
|
||||
epollConsole.Close()
|
||||
_ = epollConsole.Close()
|
||||
}
|
||||
}()
|
||||
go epoller.Wait()
|
||||
go io.Copy(epollConsole, os.Stdin)
|
||||
go func() { _ = epoller.Wait() }()
|
||||
go func() { _, _ = io.Copy(epollConsole, os.Stdin) }()
|
||||
t.wg.Add(1)
|
||||
go t.copyIO(os.Stdout, epollConsole)
|
||||
|
||||
@@ -150,7 +150,7 @@ func handleInterrupt(c console.Console) {
|
||||
sigchan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigchan, os.Interrupt)
|
||||
<-sigchan
|
||||
c.Reset()
|
||||
_ = c.Reset()
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ func (t *tty) waitConsole() error {
|
||||
// so that we no longer have copy in our process.
|
||||
func (t *tty) ClosePostStart() error {
|
||||
for _, c := range t.postStart {
|
||||
c.Close()
|
||||
_ = c.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -175,19 +175,19 @@ func (t *tty) ClosePostStart() error {
|
||||
func (t *tty) Close() error {
|
||||
// ensure that our side of the fds are always closed
|
||||
for _, c := range t.postStart {
|
||||
c.Close()
|
||||
_ = c.Close()
|
||||
}
|
||||
// the process is gone at this point, shutting down the console if we have
|
||||
// one and wait for all IO to be finished
|
||||
if t.console != nil && t.epoller != nil {
|
||||
t.console.Shutdown(t.epoller.CloseConsole)
|
||||
_ = t.console.Shutdown(t.epoller.CloseConsole)
|
||||
}
|
||||
t.wg.Wait()
|
||||
for _, c := range t.closers {
|
||||
c.Close()
|
||||
_ = c.Close()
|
||||
}
|
||||
if t.hostConsole != nil {
|
||||
t.hostConsole.Reset()
|
||||
_ = t.hostConsole.Reset()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user