mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Correct export.sh failure exit code and cleanup
In failure cases, when idf_export_main() returns 1 (failure), the export.sh script returns 0 (success). This makes it very difficult to detect failure when writing scripts that use export.sh. Furthermore, idf_export_main() does not clean up all internal variables and functions in failure cases. Move all cleanup steps into a cleanup function and pass the return value from idf_export_main() to the cleanup function so it can return with that same return value. Signed-off-by: Marek Fiala <marek.fiala@espressif.com> Closes https://github.com/espressif/esp-idf/pull/5744
This commit is contained in:
parent
8dd6d9fa5f
commit
6c564bd690
29
export.sh
29
export.sh
@ -126,7 +126,15 @@ __main() {
|
||||
__verbose " ${PATH}"
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
|
||||
__verbose "Done! You can now compile ESP-IDF projects."
|
||||
__verbose "Go to the project directory and run:"
|
||||
__verbose ""
|
||||
__verbose " idf.py build"
|
||||
__verbose ""
|
||||
}
|
||||
|
||||
__cleanup() {
|
||||
unset old_path
|
||||
unset paths
|
||||
unset path_prefix
|
||||
@ -135,16 +143,19 @@ __main() {
|
||||
unset idf_exports
|
||||
unset ESP_PYTHON
|
||||
|
||||
unset __realpath
|
||||
unset __main
|
||||
unset __verbose
|
||||
unset __enable_autocomplete
|
||||
unset __cleanup
|
||||
|
||||
# Not unsetting IDF_PYTHON_ENV_PATH, it can be used by IDF build system
|
||||
# to check whether we are using a private Python environment
|
||||
|
||||
__verbose "Done! You can now compile ESP-IDF projects."
|
||||
__verbose "Go to the project directory and run:"
|
||||
__verbose ""
|
||||
__verbose " idf.py build"
|
||||
__verbose ""
|
||||
return $1
|
||||
}
|
||||
|
||||
|
||||
__enable_autocomplete() {
|
||||
click_version="$(python -c 'import click; print(click.__version__.split(".")[0])')"
|
||||
if [[ click_version -lt 8 ]]
|
||||
@ -171,8 +182,4 @@ __enable_autocomplete() {
|
||||
|
||||
__main
|
||||
__enable_autocomplete
|
||||
|
||||
unset __realpath
|
||||
unset __main
|
||||
unset __verbose
|
||||
unset __enable_autocomplete
|
||||
__cleanup $?
|
||||
|
Loading…
Reference in New Issue
Block a user