mqtt-cli
mqtt-cli copied to clipboard
Exit code on fatal errors is incorrect
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
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?
With #308 we will refactor all commands to Callable, which should lead to all commands being assosciated with exit codes.