FAQ | This is a LIVE service | Changelog

Create Helper scripts used in packages authored by Dr Adam Thorn's avatar Dr Adam Thorn
wait-for-process.cmd
====================
* Location: %WPKGSOFTWARE%\wpkg\tools\waitforprocess.cmd
* Purpose: Some (un)installers spawn a child process, but the wpkg <install> command terminates and then wpkg continues on to the next line. This is not helpful! Thus, we have a helper script that sits in an infinite loop and only exits when the named process terminates
* Example usage:
```
<install cmd='%WPKGSOFTWARE%\wpkg\tools\waitforprocess.cmd Au_.exe' />
<install cmd='%WPKGSOFTWARE%\foo\bar\setup.exe' />
<install cmd='%WPKGSOFTWARE%\wpkg\tools\waitforprocess.cmd Au_.exe' />
```
* Note: the rationale for having three commands in that order is:
1. wait for any pre-existing Au_.exe process to finish (usually this will be a no-op)
1. run setup.exe which we've determined somehow will spawn Au_.exe
1. then wait for the Au_.exe to finish, which we are pretty confident can only be the child spawned in line 2 because we waited for any other Au_.exe processes we might have in line 1
Whilst there's a narrow window for another Au_.exe to start executing between line 1 and 2, in practice this formulation seems to work rather reliably.
\ No newline at end of file