build: check before removing %config% link

PR-URL: https://github.com/nodejs/node/pull/51437
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
liudonghua 2024-01-26 04:46:09 +08:00 committed by GitHub
parent ad5e2dab4c
commit b9a427976b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -337,7 +337,8 @@ if errorlevel 1 (
if "%target%" == "Clean" goto exit
:after-build
rd %config%
:: Check existence of %config% before removing it.
if exist %config% rd %config%
if errorlevel 1 echo "Old build output exists at 'out\%config%'. Please remove." & exit /B
:: Use /J because /D (symlink) requires special permissions.
if EXIST out\%config% mklink /J %config% out\%config%