diff --git a/util_unix.go b/util_unix.go index bad2a29..3723927 100644 --- a/util_unix.go +++ b/util_unix.go @@ -3,6 +3,7 @@ package zenity import ( + "bytes" "os/exec" "strconv" "strings" @@ -55,8 +56,9 @@ func appendIcon(args []string, opts options) []string { } func strResult(opts options, out []byte, err error) (string, error) { + out = bytes.TrimSuffix(out, []byte{'\n'}) if err, ok := err.(*exec.ExitError); ok && err.ExitCode() == 1 { - if opts.extraButton != nil && *opts.extraButton+"\n" == string(out) { + if opts.extraButton != nil && *opts.extraButton == string(out) { return "", ErrExtraButton } return "", ErrCanceled