diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-04-07 16:45:55 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-04-07 17:15:01 +1000 |
commit | 0f1abcb10c7ccef2ec287583ea790173c895ae33 (patch) | |
tree | 3ca481febe21a881bbdd0d436ada2d616e111dc3 /pkg/gui/gui.go | |
parent | 55538a36959739e07c4f1146571e27093f2b45a0 (diff) |
remove subprocess channel stuff
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 14e748857..0990779a7 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -64,20 +64,19 @@ type Teml i18n.Teml // Gui wraps the gocui Gui object which handles rendering and events type Gui struct { - g *gocui.Gui - Log *logrus.Entry - GitCommand *commands.GitCommand - OSCommand *commands.OSCommand - SubProcess *exec.Cmd - subProcessChan chan (*exec.Cmd) - State guiState - Config config.AppConfigurer - Tr *i18n.Localizer - Errors SentinelErrors - Updater *updates.Updater - statusManager *statusManager - credentials credentials - waitForIntro sync.WaitGroup + g *gocui.Gui + Log *logrus.Entry + GitCommand *commands.GitCommand + OSCommand *commands.OSCommand + SubProcess *exec.Cmd + State guiState + Config config.AppConfigurer + Tr *i18n.Localizer + Errors SentinelErrors + Updater *updates.Updater + statusManager *statusManager + credentials credentials + waitForIntro sync.WaitGroup } // for now the staging panel state, unlike the other panel states, is going to be @@ -533,8 +532,6 @@ func (gui *Gui) loadNewRepo() error { return err } } - - go gui.listenForSubprocesses() return nil } @@ -646,24 +643,6 @@ func (gui *Gui) Run() error { return err } -func (gui *Gui) listenForSubprocesses() { - // every time there is a subprocess, we're going to halt the execution of the UI via an update block, and wait for the command to finish - gui.subProcessChan = make(chan *exec.Cmd, 0) - for { - subProcess := <-gui.subProcessChan - gui.g.Update(func(*gocui.Gui) error { - subProcess.Stdin = os.Stdin - output, _ := runCommand(subProcess) - gui.State.SubProcessOutput = output - - subProcess.Stdout = ioutil.Discard - subProcess.Stderr = ioutil.Discard - subProcess.Stdin = nil - return nil - }) - } -} - // RunWithSubprocesses loops, instantiating a new gocui.Gui with each iteration // if the error returned from a run is a ErrSubProcess, it runs the subprocess // otherwise it handles the error, possibly by quitting the application |