#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Ruby Process Control question


    Hello everyone. I have to run a Windows program from Ruby but i cannot see the EXIT code if my external program crashes, as windows pops up an "Application Error" window and blocks my program. Only after i Press the "OK" button that my program resumes and i can see the value of "exit_code".
    Can anyone tell me how to make Ruby close the "Application Error" window automatically or a work around for it ?
    thanks,
    Roshan

    p.s i have disabled JIT visual studio 2008, drwatson debuggers.

    example:

    def run_program()
    exit_code = system(EXTERNAL_PROGRAM)
    puts "#{exit_code} \n" # program never reaches this line if EXTERNAL_PROGRAM crashes.


    end
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2010
    Posts
    6
    Rep Power
    0
    Kernel#system returns True or False so it wouldn't be fair to rely on that giving you a valid return code. Check out Process::Status

    This thread should help:

    http://www.eggheadcafe.com/software/aspnet/35719602/cannot-obtain-child-process-exit-code-on-windows.aspx

IMN logo majestic logo threadwatch logo seochat tools logo