mirror of
https://github.com/wagoodman/dive
synced 2026-03-14 14:25:50 +01:00
gracefully exit when no tty is present; partially addresses #253
This commit is contained in:
parent
119040e72c
commit
a26de0ed45
1 changed files with 7 additions and 0 deletions
|
|
@ -1,8 +1,11 @@
|
|||
package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/wagoodman/dive/dive/image"
|
||||
"github.com/wagoodman/dive/runtime/ui/key"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/jroimartin/gocui"
|
||||
|
|
@ -121,6 +124,10 @@ func (a *app) quit() error {
|
|||
func Run(analysis *image.AnalysisResult, treeStack filetree.Comparer) error {
|
||||
var err error
|
||||
|
||||
if !terminal.IsTerminal(int(os.Stdout.Fd())) {
|
||||
return fmt.Errorf("no tty present, refusing show ui (if running in docker, use -it args)")
|
||||
}
|
||||
|
||||
g, err := gocui.NewGui(gocui.OutputNormal)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue