Ensure atom.cmd --wait correctly waits in Windows cmd & powershell

This commit is contained in:
Damien Guard 2016-03-03 20:03:44 -08:00
parent 107a9c6696
commit 4d9e2b865b

View File

@ -22,30 +22,13 @@ FOR %%a IN (%*) DO (
)
)
rem Getting the process ID in cmd of the current cmd process: http://superuser.com/questions/881789/identify-and-kill-batch-script-started-before
set T=%TEMP%\atomCmdProcessId-%time::=%.tmp
wmic process where (Name="WMIC.exe" AND CommandLine LIKE "%%%TIME%%%") get ParentProcessId /value | find "ParentProcessId" >%T%
set /P A=<%T%
set PID=%A:~16%
del %T%
IF "%EXPECT_OUTPUT%"=="YES" (
SET ELECTRON_ENABLE_LOGGING=YES
IF "%WAIT%"=="YES" (
"%~dp0\..\..\atom.exe" --pid=%PID% %*
rem If the wait flag is set, don't exit this process until Atom tells it to.
goto waitLoop
powershell -noexit "%~dp0\..\..\atom.exe" --pid=$pid %* ; wait-event
) ELSE (
"%~dp0\..\..\atom.exe" %*
)
) ELSE (
"%~dp0\..\app\apm\bin\node.exe" "%~dp0\atom.js" %*
)
goto end
:waitLoop
sleep 1
goto waitLoop
:end