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

Exit code on fatal errors is incorrect #147

Closed
sbaier1 opened this issue Jun 18, 2020 · 2 comments · Fixed by #308
Closed

Exit code on fatal errors is incorrect #147

sbaier1 opened this issue Jun 18, 2020 · 2 comments · Fixed by #308
Labels
bug Something isn't working

Comments

@sbaier1
Copy link

sbaier1 commented Jun 18, 2020

Expected behavior

Errors on basic operations like one-shot publishing lead to a corresponding exit code != 0, so i can use MQTT cli in scripts and assert proper exit codes.

Actual behavior

MQTT CLI always exits with code 0, even when connection to the broker fails completely

To Reproduce

Steps

Run a basic command like

java -jar mqtt-cli-1.1.2.jar pub -m "test" -h localhost -q 1 --topic test

when no broker is running, followed by a echo $? to check the exit code, which will be 0 even if the connection was refused and no publish was made.

Reproducer code

N/A

Details

  • Affected MQTT CLI version(s): 1.2.0
  • Used JVM version: java11
@gitseti gitseti added the bug Something isn't working label Jun 18, 2020
@rbroggi
Copy link

rbroggi commented Feb 5, 2022

I have the same issue, I have a broker running locally (using docker-swarm). I manage to connect to the broker using the mqtt-cli (and the client connection is also visible from the broker web page). If I try to publish a message nothing happens: the message is not sent to the broker (I can see no logging even when TRACE level is enabled) and the returned code is 0 without any error. Is there at least somewhere where we can see the error from client side?

@gitseti
Copy link
Contributor

gitseti commented Jul 21, 2022

With #308 we will refactor all commands to Callable, which should lead to all commands being assosciated with exit codes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants