mbed-tools
mbed-tools copied to clipboard
Is it possible to get different "exit code" ?
Is your feature request related to a problem? Please describe.
Goal is to use `mbedtools compile xxx`` commands in scripts.
It seems that "exit code" is currently 0 when it is successful, 1 in case of issue.
Describe the solution you'd like
Do you think it is possible to have more error codes ?
- 1 would be the default error code
- 2 for issue in mbed_validate_application_profile function?
- 3 in case of CMakeLists.txt configuration issue?
- etc...
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
This seems like a good addition to allow use of mbed-tools
in scripts.
One thing to note: CMake just returns 1 for any configuration error, including the FATAL_ERROR
raised by mbed_validate_application_profile
. So, to implement the suggested error codes, we would have to check the stderr from CMake, then decide which exit code to return based on the output messages. This doesn't seem like a robust solution as the CMake output messages could change at any time.
If we decide not to create specific exit codes for different CMake configuration failures, we could at least define the following exit codes relatively easily:
-
MBED_CONFIG_PROCESSING_ERROR
-
CMAKE_CONFIGURATION_ERROR
-
CMAKE_BUILD_ERROR