in reply to How would you catch this error?

One way would be to redirect the output from the command line and capture it. Take a look at IPC::Open3 as a substitute for using open. It allows you to capture STDOUT and STDERR to different streams. Assuming that the exe in question does something as sensible as issuing the errors on a different handle to the normal output.

Perhaps easier, although it does a leave a window of opportunity for error, would be to check the status of the file before issuing the command. You might need to use sysopen or Win32API::File::createFile with the appropriate set of share attributes to detect of the file is already in use before you issue the command.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Replies are listed 'Best First'.
Re: Re: How would you catch this error?
by LanceDeeply (Chaplain) on May 09, 2003 at 18:06 UTC
    Perhaps easier, although it does a leave a window of opportunity for error, would be to check the status of the file before issuing the command.

    thanks, I like it- I like it alot!