mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
Removed terminal space check (gocui got fixed)
This commit is contained in:
parent
a01f704d61
commit
88896e9117
1 changed files with 1 additions and 31 deletions
|
|
@ -1,15 +1,8 @@
|
|||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
|
||||
"github.com/jesseduffield/lazydocker/pkg/commands"
|
||||
"github.com/jesseduffield/lazydocker/pkg/config"
|
||||
|
|
@ -58,33 +51,10 @@ func NewApp(config *config.AppConfig) (*App, error) {
|
|||
}
|
||||
|
||||
func (app *App) Run() error {
|
||||
err := waitForTerminalSpace()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = app.Gui.RunWithSubprocesses()
|
||||
err := app.Gui.RunWithSubprocesses()
|
||||
return err
|
||||
}
|
||||
|
||||
func waitForTerminalSpace() error {
|
||||
// before we do anything, we need to check that we have some window space available
|
||||
width, height, err := terminal.GetSize(int(os.Stdin.Fd()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if width > 0 && height > 0 {
|
||||
return nil
|
||||
}
|
||||
winch := make(chan os.Signal, 1)
|
||||
signal.Notify(winch, syscall.SIGWINCH)
|
||||
select {
|
||||
case <-winch:
|
||||
return nil
|
||||
case <-time.After(time.Second):
|
||||
return fmt.Errorf("there is no available terminal space")
|
||||
}
|
||||
}
|
||||
|
||||
// Close closes any resources
|
||||
func (app *App) Close() error {
|
||||
for _, closer := range app.closers {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue