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

Remote exec always reports exit code of 0 #346

Closed
sorenisanerd opened this issue Sep 17, 2014 · 3 comments
Closed

Remote exec always reports exit code of 0 #346

sorenisanerd opened this issue Sep 17, 2014 · 3 comments

Comments

@sorenisanerd
Copy link
Contributor

No matter what command I execute, consul always reports back that it got exit code 0.

In command/agent/remote_exec.go around line 140, there's this:

exitCode := 0
defer a.remoteExecWriteExitCode(&event, exitCode)

The intent is probably that when handleRemoteExec returns, remoteExecWriteExitCode is meant to be run with whatever is the current value of the exitCode variable, but according to the golang docs, exitCode is evaluated when the defer statement is evaluated.

@sorenisanerd
Copy link
Contributor Author

I'd like to take a stab at fixing this myself.

sorenisanerd added a commit to sorenisanerd/consul that referenced this issue Sep 17, 2014
Arguments to defer statements are evaluated when the defer statement is
evaluated, so pass exitCode by reference instead.

Fixes issue hashicorp#346
@sorenisanerd
Copy link
Contributor Author

Is it ok to close this issue or would you rather wait until the patch is included in a release?

@armon
Copy link
Member

armon commented Sep 22, 2014

We can close it!

@armon armon closed this as completed Sep 22, 2014
duckhan pushed a commit to duckhan/consul that referenced this issue Oct 24, 2021
duckhan pushed a commit to duckhan/consul that referenced this issue Oct 24, 2021
* Add support for L4 service-intentions config entry
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

No branches or pull requests

2 participants