Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return original command error in error tree #184

Closed
wants to merge 4 commits into from

Conversation

lpusok
Copy link
Contributor

@lpusok lpusok commented Jul 26, 2023

Shove the original command error in the error tree. This allows checking for the specific exit code by code like this:

	var exitError *exec.ExitError
	if errors.As(err, &exitError) {

wrapError did not do this, breaking code expecting the above to work. This is fixed by using a feature in go 1.20 that allows wrapping multiple errors. (https://tip.golang.org/doc/go1.20#errors)

Output on go >= 1.20:

Run: failed to shutdown Simulator, command execution failed: command failed with exit status 149 (xcrun "simctl" "shutdown" "216F1ECE-9545-4CDD-A706-199C432EA348"): check the command's output for details 

Output on go < 1.20:

Run: failed to shutdown Simulator, command execution failed: command failed with exit status 149 (xcrun "simctl" "shutdown" "D519202A-FCD1-496C-AFCC-134697A128C8"): check the command's output for details %!w(*errorutil.HiddenOriginalError=&{0x140000e67a0})

command/command.go Outdated Show resolved Hide resolved
@lpusok lpusok closed this Mar 20, 2024
@lpusok lpusok deleted the NOJIRA-original-command-error branch March 20, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant