:checkered-flag: Add race condition protection for getting process id

to make sure temp file isn't in conflict with another process and to make sure
to get the right process id
This commit is contained in:
Dave Rael
2015-11-24 15:04:53 -07:00
parent e392e5dfcc
commit ca629027ff

View File

@@ -23,10 +23,11 @@ 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%\sthUnique.tmp
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