I am trying to setup a azureDevOps pipeline for android testing on self-hosted agent(windows). For this, I need to start an emulator as a detached process in background.
I am successfully able to start a process in background using following command.
Start-Job -Name EM -ScriptBlock {D:\Android\Sdk\tools\emulator -avd testAVD -no-audio -no-window }
But this process is attached to the parent process, and hence, when Azure pipeline exits the current task, as a part of clean up - it kills this emulator also (beats my purpose of creating the emulator in first place).
So, Can anyone suggest how can I start a detached background process in powerShell? Thanks in advance!
P.S: There is one relevant post, however, it looks to be very java specific. Start a detached background process in PowerShell
I have tried
Start-Job -Name EM -ScriptBlock {& D:\Android\Sdk\tools\emulator -avd testAVD -no-audio -no-window } This looks to be not working.
StartThread-Job -Name EM -ScriptBlock {D:\Android\Sdk\tools\emulator -avd testAVD -no-audio -no-window } For this, Azurepipeline task doesnt even exit. So, this also doesnt work. Moreover, I dont think this would be a solution either, beacause by definiation of StartThread-Job, it starts a new thread in same process. Dont think it talks about detachment at all.
Any suggestions?.