You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.
However there is some caveat regarding error handling and "cancel/close dialog" actions:
I am not quite sure for what the boolean return value should have been.
The logic right now on Linux:
funcEntry(title, text, defaultTextstring) (string, bool, error)
o, err:=exec.Command(cmd, "--entry", "--title", title, "--text", text, "--entry-text", defaultText).Output()
iferr!=nil {
ifexitError, ok:=err.(*exec.ExitError); ok {
ws:=exitError.Sys().(syscall.WaitStatus)
return"", ws.ExitStatus() ==0, nil// <<<<<< Correct reporting a Cancle OR Close action
}
}
ret:=trueout:=strings.TrimSpace(string(o))
ifout=="" {
ret=false// <<<<<<<<<<<< Why is an empty answer unsuccesful. (1)
}
returnout, ret, err
}
Removing the check for the empty string at the end, would be desirable, since validation of the string should strongly be done outside of this function.
Doing this, gives the boolean value the meaning
true : if the User has pressed OK and accepts the entry.
false : the user has closed or cancled.
Any returned error is a exec Error...
With the current logic, we cannot properly distinguish between this.
The text was updated successfully, but these errors were encountered:
Thanks for this library, its helpful!
However there is some caveat regarding error handling and "cancel/close dialog" actions:
I am not quite sure for what the boolean return value should have been.
The logic right now on Linux:
Removing the check for the empty string at the end, would be desirable, since validation of the string should strongly be done outside of this function.
Doing this, gives the boolean value the meaning
true
: if the User has pressedOK
and accepts the entry.false
: the user has closed or cancled.error
is aexec
Error...With the current logic, we cannot properly distinguish between this.
The text was updated successfully, but these errors were encountered: