From 598ce272cbe7191a95160d8d16ab1d9a77ad17f0 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Sat, 22 May 2021 11:29:23 +0100 Subject: [PATCH] Fix #14. --- util_unix.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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