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

mosquitto_pub does not return error exit code when connection fails #1285

Closed
janniswarnat opened this issue May 21, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@janniswarnat
Copy link

commented May 21, 2019

Hi all,

mosquitto_pub in version 1.4.10 returned exit code 5 when a connection to Mosquitto was not allowed (e.g. after adding allow_anonymous false to mosquitto.conf):

# mosquitto_pub --debug -h mosquitto -t test -m test
Client mosqpub/6-b4743bf10343 sending CONNECT
Client mosqpub/6-b4743bf10343 received CONNACK
Connection Refused: not authorised.
Error: The connection was refused.
# echo $?
5

In version 1.6.2 mosquitto_pub returns exit code 0 in the same case:

# mosquitto_pub --debug -h mosquitto -t test -m test
Client mosq/sFqMxtgqkw9lpHaaCn sending CONNECT
Client mosq/sFqMxtgqkw9lpHaaCn received CONNACK (5)
Connection Refused: not authorised.
# echo $?
0

Is that a bug or was a deliberate design decision made to change the behaviour? I could not find anything in the mosquitto_pub docs about exit codes.

Thanks in advance for your feedback and best regards

Jannis

@ralight ralight added this to the 1.6.3 milestone May 21, 2019

ralight added a commit that referenced this issue May 21, 2019

@ralight

This comment has been minimized.

Copy link
Contributor

commented May 21, 2019

This wasn't deliberate, thanks for reporting it. I've just pushed a change that fixes it and it will be in 1.6.3.

@ralight ralight closed this May 21, 2019

ralight added a commit that referenced this issue Jun 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.