I am trying to start two processes from a Jenkins job using a Windows batch command:
REM start Selenium drivers if needed
cd "%WORKSPACE%\Uca.SeleniumTests"
start "" powershell -ExecutionPolicy unrestricted -file ./startDrivers.ps1
startDrivers.ps1
$isGeckoDriverProcessOn = Get-Process geckodriver -ErrorAction SilentlyContinue
if(!$isGeckoDriverProcessOn){
Write-Host 'Starting geckodriver'
Start-Process -FilePath "geckodriver.exe"
}
#$startChromeDriver = (Get-Item -Path ".\" -Verbose).FullName
$isChromeDriverProcessOn = Get-Process chromedriver -ErrorAction SilentlyContinue
if(!$isChromeDriverProcessOn){
Write-Host 'Starting chromedriver'
Start-Process -FilePath "chromedriver.exe"
}
This works fine when run from a command prompt, but the processes are immediately killed when run from Jenkins in spite of trying to run in another session (start).
Jenkins slave is started from command prompt and I can see the process windows being shown for half a second. My feeling is that Jenkins is killing command line sessions and these processes along with it.
Question: How to execute a windows batch command in Jenkins that is not killed?