Search code examples
appveyor

How to run a program in background through appveyor.yml?


I have two exe's. One should be started as a server and open a pipe for interaction. Another would connect through this win pipe and run testing requests to it.

The problem is that after when I try to start programm1.exe in appveyor.yml script, I see no output and further instructions not being executed.

I need smth like this:

start programm1.exe --options
start programm2.exe --options
set output of programm2 to appveyor log
wait until programm2 finished
stop programm1

If you know how to do this, please share your experience, thanks!


Solution

  • You can use Start-Process and Stop-Process cmdlets to do that. You need to save started process information in variable to be able to stop it.

    Here are how commands can look in appveyor.yml style:

    install:
      - ps: $MyProcess = Start-Process notepad.exe -PassThru
    
    on_finish:
      - ps: Stop-Process -Id $MyProcess.Id
    

    Hope this helps.

    --ilya