Fix auto-close (windows).
This commit is contained in:
parent
357c0f2c0a
commit
02df100678
3 changed files with 7 additions and 4 deletions
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue