I am attempting to handle windows native command errors within a Ruby script on
windows xp. Commands in backticks like `net use ...` do not allow for this. I
tried open3, but it is unsupported on windows because of the lack of fork.
system() does not do anything either. How do others handle this on windows? I
only want to use the core Ruby library, not win32 utils.
begin
`windows command`
rescue SomeException => e
do this to handle this exception...
rescue SomeOtherException =>
do this for the other exception...
end
Use "system" if you want the exit code of the system command you are
running. Use backticks if you need the output from the command you
invoked.
Does that help?
···
On 11/8/06, Brad Tilley <rtilley@vt.edu> wrote:
I am attempting to handle windows native command errors within a Ruby script on
windows xp. Commands in backticks like `net use ...` do not allow for this. I
tried open3, but it is unsupported on windows because of the lack of fork.
system() does not do anything either. How do others handle this on windows? I
only want to use the core Ruby library, not win32 utils.
begin
`windows command`
rescue SomeException => e
do this to handle this exception...
rescue SomeOtherException =>
do this for the other exception...
end