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

rosnode: Return exit code 1 if there is an error. #1178

Merged
merged 1 commit into from
Oct 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/rosnode/src/rosnode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,12 @@ def rosnodemain(argv=None):
_fullusage()
except socket.error:
print("Network communication failed. Most likely failed to communicate with master.", file=sys.stderr)
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preferred style would be to return 1 here, and then sys.exit(rosnode.rosnodemain()) in the wrapper script, but there are direct sys.exit calls elsewhere in this same function, so I think it makes sense to follow the prevailing style as you have done.

except rosgraph.MasterError as e:
print("ERROR: "+str(e), file=sys.stderr)
sys.exit(1)
except ROSNodeException as e:
print("ERROR: "+str(e), file=sys.stderr)
sys.exit(1)
except KeyboardInterrupt:
pass