diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/commands/os.go | 4 | ||||
-rw-r--r-- | pkg/gui/gui.go | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 3be1e1288..14a3721ad 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -153,9 +153,5 @@ func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error) { // PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) (*exec.Cmd, error) { subprocess := exec.Command(cmdName, commandArgs...) - subprocess.Stdin = os.Stdin - subprocess.Stdout = os.Stdout - subprocess.Stderr = os.Stderr - return subprocess, nil } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index c607ba79e..9cd7d35e6 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -6,7 +6,9 @@ import ( // "io/ioutil" "errors" + "io/ioutil" "log" + "os" "os/exec" "runtime" "strings" @@ -31,7 +33,7 @@ var ( // Gui wraps the gocui Gui object which handles rendering and events type Gui struct { - Gui *gocui.Gui + g *gocui.Gui Log *logrus.Logger GitCommand *commands.GitCommand OSCommand *commands.OSCommand @@ -309,6 +311,8 @@ func (gui *Gui) Run() error { } defer g.Close() + gui.g = g // TODO: always use gui.g rather than passing g around everywhere + g.FgColor = gocui.ColorDefault gui.goEvery(g, time.Second*60, gui.fetch) @@ -334,7 +338,13 @@ func (gui *Gui) RunWithSubprocesses() { if err == gocui.ErrQuit { break } else if err == ErrSubProcess { + gui.SubProcess.Stdin = os.Stdin + gui.SubProcess.Stdout = os.Stdout + gui.SubProcess.Stderr = os.Stderr gui.SubProcess.Run() + gui.SubProcess.Stdout = ioutil.Discard + gui.SubProcess.Stderr = ioutil.Discard + gui.SubProcess.Stdin = nil gui.SubProcess = nil } else { log.Panicln(err) |