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,8 +405,7 @@ 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 {
|
||||||
|
|
@ -422,7 +422,6 @@ func (c *Container) Attach() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Container) Resize(fd int) error {
|
func (c *Container) Resize(fd int) error {
|
||||||
width, height, err := terminal.GetSize(fd)
|
width, height, err := terminal.GetSize(fd)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue