From 0fc27f6bc0a5ca8bc2a6458ee61b78906840ea7e Mon Sep 17 00:00:00 2001
From: Refael Ackermann <refack@gmail.com>
Date: Sat, 13 Apr 2019 10:06:00 -0400
Subject: [PATCH] build,win: bail vcbuild if mklink fails

PR-URL: https://github.com/nodejs/node/pull/27216
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
---
 vcbuild.bat | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/vcbuild.bat b/vcbuild.bat
index 650218c21910fd..57824dca730dc0 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -325,7 +325,10 @@ if errorlevel 1 (
 if "%target%" == "Clean" goto exit
 
 :after-build
+rd %config%
+if errorlevel 1 echo "Old build output exists at 'out\%config%'. Please remove." & exit /B
 if EXIST out\%config% mklink /D %config% out\%config%
+if errorlevel 1 exit /B
 
 :sign
 @rem Skip signing unless the `sign` option was specified.