File.popen/IO.popen

Discussion in 'Ruby' started by hariwise@gmail.com, May 20, 2006.

  1. Guest

    Hi:

    >From ruby code, I am executing another command and reading the output

    using File.popen.
    The external command might run for a long time and I was to ensure that
    if the ruby interpreter is terminated, the process that is executing
    the command is cleaned up as well.

    How do I accomplish this ? I am working in windows.

    Thanks.
    , May 20, 2006
    #1
    1. Advertising

  2. wrote:
    > Hi:
    >
    >>From ruby code, I am executing another command and reading the output

    > using File.popen.
    > The external command might run for a long time and I was to ensure that
    > if the ruby interpreter is terminated, the process that is executing
    > the command is cleaned up as well.
    >
    > How do I accomplish this ? I am working in windows.


    At least under cygwin this should work: use method #pid of the IO object
    created by popen() to record the process id. Then trap SIGINT (or
    whatever) and send it via Process.kill to the child process.

    Kind regards

    robert
    Robert Klemme, May 20, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kamil Grymuza
    Replies:
    0
    Views:
    313
    Kamil Grymuza
    May 25, 2005
  2. Kamil Grymuza
    Replies:
    5
    Views:
    7,230
    msalters
    May 27, 2005
  3. John Pye

    subprocess.Popen output to file?

    John Pye, Apr 7, 2007, in forum: Python
    Replies:
    1
    Views:
    2,502
    Marc 'BlackJack' Rintsch
    Apr 7, 2007
  4. Replies:
    2
    Views:
    664
    Matt Nordhoff
    Jul 10, 2008
  5. Helmut Jarausch
    Replies:
    8
    Views:
    2,245
Loading...

Share This Page