mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-03-19 21:28:28 +02:00
remove subprocess channel stuff
This commit is contained in:
parent
55538a3695
commit
0f1abcb10c
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user