1

I wrote a powershell script to start my flask server, run my tests then stop my server. It starts the server and runs my tests. However, when it kills the $server process, it leaves the actual server process running and I can see the window for this process still open. How can I kill the server after the tests finish running?

$db_id = [guid]::NewGuid().ToString()
$env:AUTHZ_DB_FILE = 'Authorization ' + $db_id
$server = Start-Process py -ArgumentList '-m', 'authz.test.server' -PassThru 

Write-Output $server.Id

py -m authz.test.tests $args

Stop-Process -Id $server.Id
Dullmann
  • 11
  • 2
  • your code appears to be starting python ... is the _original python process_ still running OR is the process you see one that was started by the 1st python script? – Lee_Dailey May 27 '20 at 09:05

1 Answers1

1

Try

Stop-Process -Id $server.Id -Force

jstuart-tech
  • 146
  • 5