win32/process Process.create failure

Discussion in 'Ruby' started by Mike Stead, Mar 24, 2010.

  1. Mike Stead

    Mike Stead Guest

    Hi all, I'm hoping you can lend me some help.

    I make the following call:

    require 'win32/process'
    Process.create:)app_name => "perl C:/bin/filepp-1.8.0/filepp.pl -c")

    This fails with the error:

    CreateProcess() failed:

    And as you can see provides no info around the failure.

    This same command works fine through cygwin and dos prompt.

    Can anyone give me some idea of what I'm doing wrong?
    Mike Stead, Mar 24, 2010
    #1
    1. Advertising

  2. Mike Stead

    Roger Pack Guest


    > require 'win32/process'
    > Process.create:)app_name => "perl C:/bin/filepp-1.8.0/filepp.pl -c")
    >
    > This fails with the error:
    >
    > CreateProcess() failed:


    Mine seems to work ok.

    >> Process.create:)app_name => '"c:\Program Files\Git\bin\perl.exe" c:\installs\bin\ack.pl asdf --ruby')

    => #<struct Struct::processInfo process_handle=1916, thread_handle=1896,
    process_id=5640, thread_id=1904>

    Does system("..") work with the same call?
    If you get truly desperate there's 1.9.1's "Process.spawn"
    -rp
    --
    Posted via http://www.ruby-forum.com/.
    Roger Pack, Mar 24, 2010
    #2
    1. Advertising

  3. Mike Stead

    Mike Stead Guest

    On Mar 25, 3:19 am, Roger Pack <> wrote:
    > > require 'win32/process'
    > > Process.create:)app_name => "perl C:/bin/filepp-1.8.0/filepp.pl -c")

    >
    > > This fails with the error:

    >
    > > CreateProcess() failed:

    >
    > Mine seems to work ok.
    >
    > >> Process.create:)app_name => '"c:\Program Files\Git\bin\perl.exe" c:\installs\bin\ack.pl asdf --ruby')

    >
    > => #<struct Struct::processInfo process_handle=1916, thread_handle=1896,
    > process_id=5640, thread_id=1904>
    >
    > Does system("..") work with the same call?
    > If you get truly desperate there's 1.9.1's "Process.spawn"
    > -rp
    > --
    > Posted viahttp://www.ruby-forum.com/.


    Thanks for the response.

    This is gem code so really needs to work with older versions of ruby.
    Also something I maybe should have said to begin with (was trying not
    to overcomplicate the issue) is that I'm needing to capture the stdin,
    stdout and stderr.

    I first tried using win32-open3's Open3.popen but had issues trying to
    kill the process when I was done with it so then moved onto win32/
    process. I'm now looking at the systemu gem in the hope it will work
    without problem.

    With Open4 I make the following call on my mac with no issues.

    @pid, @w, @r, @e = open4.popen4("perl C:/bin/filepp-1.8.0/filepp.pl -
    c")

    Does anyone know how I can do this same thing with systemu, assigning
    the stdin, stdout and stderr to variables?

    Oh and system(cmd) does work but I need to be able to kill the process
    once I'm done r/w from its associated streams.

    Appreciate any help.
    Mike Stead, Mar 24, 2010
    #3
  4. Mike Stead

    Roger Pack Guest

    Mike Stead wrote:
    > On Mar 25, 3:19�am, Roger Pack <> wrote:
    >>
    >> => #<struct Struct::processInfo process_handle=1916, thread_handle=1896,
    >> process_id=5640, thread_id=1904>
    >>
    >> Does system("..") work with the same call?


    I assume this does work then?

    > Thanks for the response.
    >
    > This is gem code so really needs to work with older versions of ruby.
    > Also something I maybe should have said to begin with (was trying not
    > to overcomplicate the issue) is that I'm needing to capture the stdin,
    > stdout and stderr.


    Yeah win32/process *should* work.
    You could also try it on other boxes.
    you could also file a bug report with them (preferably with a
    reproducible test case, which might be hard here...).
    http://rubyforge.org/tracker/?group_id=85

    Also try different version of ruby? (one click versus rubyinstaller...)

    -rp
    --
    Posted via http://www.ruby-forum.com/.
    Roger Pack, Mar 25, 2010
    #4
    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. Ilias Lazaridis
    Replies:
    0
    Views:
    568
    Ilias Lazaridis
    Feb 1, 2005
  2. Java and Swing
    Replies:
    1
    Views:
    670
    Chris Lambacher
    Oct 24, 2005
  3. Tim Golden
    Replies:
    0
    Views:
    437
    Tim Golden
    Oct 21, 2005
  4. Replies:
    0
    Views:
    466
  5. Qi Lu
    Replies:
    0
    Views:
    400
    Qi Lu
    Jul 14, 2008
Loading...

Share This Page