Search code examples
bashwine

Waiting for wine to finish running


My current script looks like this:

cd ~/.wine/drive_c/
echo "test123" > foo$$.txt
wine start "C:\foo$$.txt"
wineserver -w
echo "Wine is done!"

which works fine when only one program is running in wine at a time. However if I run this a second time, before the first program is done, both scripts will wait for each others programs to exit.

This does not work:

cd ~/.wine/drive_c/
echo "test123" > foo$$.txt
$(wine start "C:\foo$$.txt") &
wait ${!}
echo "Wine is done!"

as it will exit before you close the text editor.

I need to use the start command, because I want a file to be run with its default editor/viewer.


Solution

  • wineserver has a --wait flag which can be used to do exactly that.

    However if you run multiple programs at once, it will wait for all of them to finish.