mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
simplify loop
This commit is contained in:
parent
c4240e0ff0
commit
5cb1570039
1 changed files with 14 additions and 15 deletions
|
|
@ -394,6 +394,7 @@ func (c *Container) Attach() error {
|
||||||
if c.Details.Config.OpenStdin {
|
if c.Details.Config.OpenStdin {
|
||||||
go func() {
|
go func() {
|
||||||
// the default escape key sequence: ctrl-p, ctrl-q
|
// the default escape key sequence: ctrl-p, ctrl-q
|
||||||
|
//
|
||||||
// shamelessly taken from docker/cli
|
// shamelessly taken from docker/cli
|
||||||
escapeKeys := []byte{16, 17}
|
escapeKeys := []byte{16, 17}
|
||||||
// Stop reading if escape sequence had been entered
|
// Stop reading if escape sequence had been entered
|
||||||
|
|
@ -404,22 +405,20 @@ func (c *Container) Attach() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
sig := <-channel
|
||||||
case sig := <-channel:
|
if sig == syscall.SIGWINCH {
|
||||||
if sig == syscall.SIGWINCH {
|
err := c.Resize(fd)
|
||||||
err := c.Resize(fd)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = terminal.Restore(fd, oldState)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
hijack.Close()
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
err = terminal.Restore(fd, oldState)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
hijack.Close()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue