diff --git a/cmd/zenity/main.go b/cmd/zenity/main.go index 3b35d9b..a31fb58 100644 --- a/cmd/zenity/main.go +++ b/cmd/zenity/main.go @@ -219,9 +219,7 @@ func setupFlags() { flag.BoolVar(&pulsate, "pulsate", false, "Pulsate progress bar") flag.BoolVar(&noCancel, "no-cancel", false, "Hide Cancel button (Windows and Unix only)") flag.BoolVar(&autoClose, "auto-close", false, "Dismiss the dialog when 100% has been reached") - if runtime.GOOS != "windows" { - flag.BoolVar(&autoKill, "auto-kill", false, "Kill parent process if Cancel button is pressed (macOS and Unix only)") - } + flag.BoolVar(&autoKill, "auto-kill", false, "Kill parent process if Cancel button is pressed (macOS and Unix only)") // Notify options flag.BoolVar(&listen, "listen", false, "Listen for commands on stdin") diff --git a/cmd/zenity/progress.go b/cmd/zenity/progress.go index 01ca755..065c613 100644 --- a/cmd/zenity/progress.go +++ b/cmd/zenity/progress.go @@ -69,6 +69,8 @@ func progress(opts ...zenity.Option) (err error) { if err := dlg.Complete(); err != nil { return err } - <-dlg.Done() + if !autoClose { + <-dlg.Done() + } return dlg.Close() } diff --git a/progress_windows.go b/progress_windows.go index 0d2d58d..d876d75 100644 --- a/progress_windows.go +++ b/progress_windows.go @@ -257,5 +257,8 @@ func (d *progressDialog) Complete() error { func (d *progressDialog) Close() error { sendMessage.Call(d.wnd, 0x0112 /* WM_SYSCOMMAND */, 0xf060 /* SC_CLOSE */, 0) <-d.done + if d.err == ErrCanceled { + return nil + } return d.err }