Closed rwbot closed 3 years ago
catkin build
returns an exit code of 1
when the build was not successful. It can be used in aliases or shell functions.
To use it in your alias, replace ;
with &&
. &&
only executes the next command if the previous command was successful, ;
always executes the next command. If you want to know more about that, search for “shell control operators“ on the internet.
Within my workflow, I use a few aliases to speed up building and running a C++ node:
After making changes to a C++ file, I'll save, switch to terminal and type
bsr
. When it builds successfully, it works perfectly. However, whencatkin build
fails, the alias continues along sourcing the workspace and launching the node and I have to quickly cancel it.I'd like to convert the
bsr
alias into a bash function to evaluate if the build succeeded before attempting to source and run. But I'm unable to determine if and how catkin build returns some sort of boolean upon completion indicating whether the build failed or succeeded.Does anyone know if and how
catkin build
returns a boolean or any type of env variable upon completion indicating whether the build failed or succeeded ? If so, how do I access it?