Thanks JamesNC, that's a good suggestion and it creates the behavior I want. I have rewritten the code as below to use the '1' when using 'start' and to dispatch directly (without the '1') when not using start (i.e. for when I provide the absolute path name of an executable for this routine to run for me.) However, :-(
When I go to check for the success of running the process by 'system' and 'start' (as seen below by the value printed in 'prob_foundA'), I no longer get a simple-to-check "0-if-OK, non-zero-if-problem" type of return. For example, if the spreadsheet is already in use and I then try running this program, I get the following response:
prob_foundA: '1608'
The process cannot access the file because it is being used by another
+ process.
A normal/successful run produces:
prob_foundA: '756'
And the number back upon success is not even consistently '756', it might be '1632', '528', '408' such that the '1608' above is also likely unrelated to the failure to run the command via 'system'.
So, my next question becomes "How do I know whether 'system' ran the command successfully if I use this '1' trick?" (Trying 'perldoc -f system' and 'perldoc -f exec' tells me a lot but I can't see it mentioning the '1' behavior)
Modified code:
|