summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-04-07 16:45:55 +1000
committerJesse Duffield <jessedduffield@gmail.com>2019-04-07 17:15:01 +1000
commit0f1abcb10c7ccef2ec287583ea790173c895ae33 (patch)
tree3ca481febe21a881bbdd0d436ada2d616e111dc3 /pkg
parent55538a36959739e07c4f1146571e27093f2b45a0 (diff)
remove subprocess channel stuff
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/files_panel.go4
-rw-r--r--pkg/gui/gui.go47
2 files changed, 13 insertions, 38 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 5e89632eb..b0b2db156 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -601,10 +601,6 @@ func (gui *Gui) handleCreateResetMenu(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) handleCustomCommand(g *gocui.Gui, v *gocui.View) error {
- // gui.subProcessChan <- gui.OSCommand.RunCustomCommand(`read -p "Name: " name; echo $name; read -p "Okay: " okay; echo $okay`)
-
- // return nil
-
return gui.createPromptPanel(g, v, gui.Tr.SLocalize("CustomCommand"), func(g *gocui.Gui, v *gocui.View) error {
command := gui.trimmedContent(v)
gui.SubProcess = gui.OSCommand.RunCustomCommand(command)
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