Skip to content

Commit

Permalink
fix: reset cmd if no config found.
Browse files Browse the repository at this point in the history
  • Loading branch information
cangzhang committed Sep 8, 2021
1 parent e73a0d3 commit 7ead0d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func runCmd(bin string, config *Config) {
args := []string{"-c", config.jsonPath}
cmd := exec.Command(bin, args...)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true, CreationFlags: 0x08000000}
config.cmd = cmd

stdout, err := cmd.StdoutPipe()
if err != nil {
Expand Down Expand Up @@ -106,9 +105,11 @@ func runCmd(bin string, config *Config) {
}()

wg.Wait()
config.cmd = cmd

defer killCmd(config)
if err := cmd.Wait(); err != nil {
config.cmd = nil
config.logToTextarea(err.Error())
return
}
Expand Down

0 comments on commit 7ead0d3

Please sign in to comment.