I'm writing a script that should run two python apps and then cycle through solution files, searching for new and updated files with py
and json
extensions and restarting these apps every time any condition is fulfilled. I hit a wall at the point where I get file names. At this point (line 6), the second ps window just closes instantly even though two different commands should pause it and two more after, it just exits if there is where
part on line 6, doing nothing.
$bot = start python .\source\run.py -WorkingDirectory .\bot -WindowStyle Hidden -PassThru # start bot app and save info about it
$web = start python .\source\run.py -WorkingDirectory .\web -WindowStyle Hidden -PassThru # start web app and save info about it
$cycle = start powershell { # start new ps window which will check if any file was changed
cmd /c pause # does nothing ???
Read-Host # does nothing ???
$fs = dir .\ -recurse | where { $_.extension -in ".py",".json" };
cmd /c pause # does nothing ???
Read-Host # does nothing ???
} -PassThru
echo Stop? # indicate script is ready to stop
Read-Host # wait for input before stopping
Stop-Process -Id $bot.Id # stop bot app
Stop-Process -Id $web.Id # stop web app
Stop-Process -Id $cycle.Id # stop second ps window