swri-robotics / bag-database

A server that catalogs bag files and provides a web-based UI for accessing them.
Other
344 stars 71 forks source link

Script success is set to false even on zero exit code if any stderr was present #133

Closed ansgri closed 3 years ago

ansgri commented 3 years ago

We have some scripts that generate warnings to stderr from underlying libraries, and even though the script finishes successfully, returning 0 exit code, its success is set to false. As I see from the code (https://github.com/swri-robotics/bag-database/blob/271e61d119b8ec060c0682358af54118b8ba76b8/src/main/java/com/github/swrirobotics/scripts/RunnableScript.java#L269), currently success is impossible if any stderr is present.

This behaviour is inconsistent with most task execution systems where the process' exit code is examined. If backward compatibility is important, one workaround may be to allow specifying 'success' field as part of the JSON output of the script, and if it is set, it would override other BDB logic.

pjreed commented 3 years ago

That's a good point; getting the exit code should be pretty easy, and it would make more sense to set the success based on that. For backward compatibility, I'll probably have it check the output for something like a useExitCodeForSuccess value that, if present, will cause it to ignore stderr and set the success flag based on the exit code instead.