1
1
@ echo off
2
2
if defined MSYSTEM (
3
3
echo This .bat file is for Windows CMD.EXE shell only.
4
- goto end
4
+ goto : __end
5
5
)
6
6
7
+ set SCRIPT_EXIT_CODE = 0
8
+
7
9
:: Missing requirements check
8
10
set MISSING_REQUIREMENTS =
9
11
python.exe --version > NUL 2 > NUL
10
- if %errorlevel% neq 0 set " MISSING_REQUIREMENTS = python &echo\"
12
+ if %errorlevel% neq 0 (
13
+ set SCRIPT_EXIT_CODE = %errorlevel%
14
+ set " MISSING_REQUIREMENTS = python &echo\"
15
+ )
11
16
git.exe --version > NUL 2 > NUL
12
- if %errorlevel% neq 0 set " MISSING_REQUIREMENTS = %MISSING_REQUIREMENTS% git"
17
+ if %errorlevel% neq 0 (
18
+ set SCRIPT_EXIT_CODE = %errorlevel%
19
+ set " MISSING_REQUIREMENTS = %MISSING_REQUIREMENTS% git"
20
+ )
13
21
14
- if not " %MISSING_REQUIREMENTS% " == " " goto :error_missing_requirements
22
+ if not " %MISSING_REQUIREMENTS% " == " " goto :__error_missing_requirements
15
23
16
24
:: Infer IDF_PATH from script location
17
25
set IDF_PATH = %~dp0
@@ -21,19 +29,25 @@ for /f "delims=" %%i in ('python.exe "%IDF_PATH%\tools\install_util.py" extract
21
29
22
30
echo Installing ESP-IDF tools
23
31
python.exe " %IDF_PATH% \tools\idf_tools.py" install --targets=%TARGETS%
24
- if %errorlevel% neq 0 goto :end
32
+ if %errorlevel% neq 0 (
33
+ set SCRIPT_EXIT_CODE = %errorlevel%
34
+ goto :__end
35
+ )
25
36
26
37
for /f " delims=" %%i in ('python.exe " %IDF_PATH% \tools\install_util.py" extract features " %* " ') do set FEATURES = %%i
27
38
28
39
echo Setting up Python environment
29
40
python.exe " %IDF_PATH% \tools\idf_tools.py" install-python-env --features=%FEATURES%
30
- if %errorlevel% neq 0 goto :end
41
+ if %errorlevel% neq 0 (
42
+ set SCRIPT_EXIT_CODE = %errorlevel%
43
+ goto :__end
44
+ )
31
45
32
46
echo All done! You can now run:
33
47
echo export.bat
34
- goto :end
48
+ goto :__end
35
49
36
- :error_missing_requirements
50
+ :__error_missing_requirements
37
51
echo .
38
52
echo Error^ : The following tools are not installed in your environment.
39
53
echo .
@@ -42,6 +56,7 @@ goto :end
42
56
echo Please use the Windows Tool installer for setting up your environment.
43
57
echo Download link: https://dl.espressif.com/dl/esp-idf/
44
58
echo For more details please visit our website: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/windows-setup.html
45
- goto :end
59
+ goto :__end
46
60
47
- :end
61
+ :__end
62
+ exit /b %SCRIPT_EXIT_CODE%
0 commit comments