add silent command running

This commit is contained in:
Clément PÉAU 2024-06-16 00:16:13 +02:00
parent 0beb4dd4d4
commit 6cd2e5625d

View file

@ -37,7 +37,23 @@ func (gui *Gui) runSubprocessWithMessage(cmd *exec.Cmd, msg string) error {
return err
}
func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) {
func (gui *Gui) runCommandSilently(cmd *exec.Cmd) error {
stop := make(chan os.Signal, 1)
defer signal.Stop(stop)
go func() {
signal.Notify(stop, os.Interrupt)
<-stop
if err := gui.OSCommand.Kill(cmd); err != nil {
gui.Log.Error(err)
}
}()
return cmd.Run()
}
func (gui *Gui) runCommand(cmd *exec.Cmd, msg string) error {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stdout
cmd.Stdin = os.Stdin