mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31: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
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
|
||||||
|
|
||||||
"github.com/jesseduffield/lazydocker/pkg/commands"
|
"github.com/jesseduffield/lazydocker/pkg/commands"
|
||||||
"github.com/jesseduffield/lazydocker/pkg/config"
|
"github.com/jesseduffield/lazydocker/pkg/config"
|
||||||
|
|
@ -58,33 +51,10 @@ func NewApp(config *config.AppConfig) (*App, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *App) Run() error {
|
func (app *App) Run() error {
|
||||||
err := waitForTerminalSpace()
|
err := app.Gui.RunWithSubprocesses()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = app.Gui.RunWithSubprocesses()
|
|
||||||
return err
|
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
|
// Close closes any resources
|
||||||
func (app *App) Close() error {
|
func (app *App) Close() error {
|
||||||
for _, closer := range app.closers {
|
for _, closer := range app.closers {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue