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

dcping: Set return code on error #105

Open
modelrockettier opened this issue Nov 2, 2019 · 0 comments

Comments

@modelrockettier
Copy link

@modelrockettier modelrockettier commented Nov 2, 2019

The dcping ping command always exits with a 0 status, which makes it harder to integrate into scripts since you have to parse through the output to figure out if the hub is working.

It would be nice if dcping ping followed the standard conventions of returning 0 on success and non-zero if something goes wrong (it could also be handy to have different return codes for different errors, but even just a single error code would be nice to differentiate it from a successful ping).

E.g.

# dcping ping 127.0.0.1:1411 2>/dev/null
{"name":"GoHub","desc":"Hybrid hub","addr":["adcs://127.0.0.1:1411"],"encoding":"utf-8","soft":{"name":"GoHub","vers":"0.20.0","ext":["BAS0","TIGR","PING","UCMD","UCM0","ZLIF","BASE"]},"users":1}

# echo "Return code: $?"
Return code: 0

# dcping ping 127.0.0.1:411 2>/dev/null
{"addr":["127.0.0.1:411"],"status":"error"}

# echo "Return code: $?" # It would be nice if this was not 0
Return code: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.