# Win32/process Process.create failure

**URL:** <https://www.ruby-forum.com/t/win32-process-process-create-failure/185657>\
**Category:** Ruby\
**Created:** [March 24, 2010, 7:10am UTC](https://www.ruby-forum.com/t/win32-process-process-create-failure/185657 "2010-03-24T07:10:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Stead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f1d935/32.png) [@Mike\_Stead](https://www.ruby-forum.com/u/Mike_Stead)\
**Post date:** [March 24, 2010, 7:10am UTC](https://www.ruby-forum.com/t/win32-process-process-create-failure/185657/1 "2010-03-24T07:10:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mike\_Stead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f1d935/32.png) [@Mike\_Stead](https://www.ruby-forum.com/u/Mike_Stead)\
**Post date:** [March 24, 2010, 5:19pm UTC](https://www.ruby-forum.com/t/win32-process-process-create-failure/185657/2 "2010-03-24T17:19:06Z")

</div>

> 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’)  
> > =\> #

Does system("…") work with the same call?  
If you get truly desperate there’s 1.9.1’s “Process.spawn”  
-rp

---

<div class="post-metadata">

**Author:** ![Mike\_Stead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f1d935/32.png) [@Mike\_Stead](https://www.ruby-forum.com/u/Mike_Stead)\
**Post date:** [March 25, 2010, 2:15am UTC](https://www.ruby-forum.com/t/win32-process-process-create-failure/185657/3 "2010-03-25T02:15:02Z")

</div>

Mike Stead wrote:

> On Mar 25, 3:19ï¿½am, Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > =\> #
> > 
> > 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](http://rubyforge.org/tracker/?group_id=85)

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

-rp

---

<div class="post-metadata">

**Author:** ![Mike\_Stead](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f1d935/32.png) [@Mike\_Stead](https://www.ruby-forum.com/u/Mike_Stead)\
**Post date:** [March 25, 2010, 12:54am UTC](https://www.ruby-forum.com/t/win32-process-process-create-failure/185657/4 "2010-03-25T00:54:59Z")

</div>

On Mar 25, 3:19 am, Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> =\> #
> 
> ## 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.
