Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Keith MARSHALL <keith.marshall@to...> - 2006-09-29 14:06:10
|
Earnie Boyd wrote: >> #!/bin/sh >> # >> 'c:/Program Files/Microsoft Office/Office/winword' "$@" >> # >> # `winword' always forks a background process, even if we don't >> # explicitly request it, so wait for it to finish... >> # >> wait $! >> # >> # now we can do whatever we need to, after `winword' has finished. >> # >> ... > > Does your example work for 1.0.10? Yes. > It doesn't for 1.0.11. Oh dear. Something else that's been broken since 1.0.10 :-( Or could it be different version dependent behaviour in Windoze or Office? I'm on Win2K-SP4, and MS-Office2K, (which I avoid like the plague, as much as possible :-) -- vim + groff + ghostscript ==> superior documents). > I'm thinking that maybe all ``native'' children will respond in kind > if there is no console. The MSYS children may indeed wait regardless > if there is a console but I don't know that yet. Hmm. Curiously, if we substitute `excel' for `winword' in the example, it blocks -- `wait' is not needed. To make it non-blocking, we have to add the ampersand: 'c:/Program Files/Microsoft Office/Office/excel' "$@" & So, if we now modify the original example: #!/bin/sh # # we need the ampersand after `excel', to stop it blocking; # if we leave it off, we will not see `winword' start, until # the user quits `excel' # 'c:/Program Files/Microsoft Office/Office/excel' "$@" & # # but, because we did force `excel' to background, we can see # both `excel' and `winword' start, and run simultaneously # 'c:/Program Files/Microsoft Office/Office/winword' "$@" # # `winword' always forks a background process, even if we don't # explicitly request it, so wait for it to finish... # wait $! # # now, do some more... With MSYS-1.0.10, this blocks on the `wait $!', until `winword' exits; it doesn't wait for `excel'. Of course, this illustrates the difference between `wait $!' and `wait' without any PID argument; if we replace the `wait $!' with a simple `wait', this script will wait for *both* `excel' and `winword', (strictly, *all* children it has spawned in background). Regards, Keith. |