# \[ANN\] win32\_popen 0.1

**URL:** <https://rubytalk.org/t/ann-win32-popen-0-1/3868>\
**Category:** ruby-talk\
**Created:** [31 December 2002 07:01 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868 "2002-12-31T07:01:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Park\_Heesob5](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@Park\_Heesob5](https://rubytalk.org/u/Park_Heesob5)\
**Post date:** [31 December 2002 07:01 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/1 "2002-12-31T07:01:42Z")

</div>

Hi, all.

win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
Python source code.

You can use win32\_popen3 like this:

require ‘win32\_popen’

fin,fout,ferr = IO.win32\_popen3(“date”)  
puts fout.gets  
fin.print “2002-01-01\n”  
while !fout.eof  
puts fout.gets  
end

fin,fout,ferr = IO.win32\_popen3(“irb”)

begin  
a = fout.getc  
putc a.chr  
end while a != ?\>

fin.print “exit\n”

while !fout.eof  
puts fout.gets  
end

You can download mswin binary for your Ruby version.  
[http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
[http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
Souce code and binary included.

[Requirement]

- Ruby 1.6.5+

It may be made with other version but not verified.

[Install binary]

> ruby install.rb

[Install from source]

> ruby extconf.rb  
> nmake  
> ruby install.rb

[methods]

IO#win32\_popen2(cmd[, mode])  
Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
child\_stdout).

IO#win32\_popen3(cmd[, mode])  
Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
child\_stdout, child\_stderr).

IO#win32\_popen4(cmd[, mode]])  
Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
child\_stdout\_and\_stderr).

Regards.

Park Heesob

---

<div class="post-metadata">

**Author:** ![Phlip5](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@Phlip5](https://rubytalk.org/u/Phlip5)\
**Post date:** [31 December 2002 07:01 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/2 "2002-12-31T07:01:48Z")

</div>

Park Heesob wrote:

> win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> Python source code.

I prostrate myself in honor of one who has cracked that tough nut.

Question: Why are pipes so \>fucking\< hard???

> **···**
>
> –  
> Phlip  
> [I gotta have my orange juice. | Jesu, Juva](http://andstuff.org/CelebrityImpersonations)  
> – Whip me. Beat me. Make me install Oracle. –

---

<div class="post-metadata">

**Author:** ![Lyle\_Johnson6](https://avatars.discourse-cdn.com/v4/letter/l/bb73d2/32.png) [@Lyle\_Johnson6](https://rubytalk.org/u/Lyle_Johnson6)\
**Post date:** [31 December 2002 12:42 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/3 "2002-12-31T12:42:26Z")

</div>

Park Heesob wrote:

> win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> Python source code.

Wow, what a great late Christmas present!

Thanks very much.

---

<div class="post-metadata">

**Author:** ![Rich\_Kilmer](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rich\_Kilmer](https://rubytalk.org/u/Rich_Kilmer)\
**Post date:** [31 December 2002 14:40 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/4 "2002-12-31T14:40:24Z")

</div>

Bless you…seriously!

This will be integrated into FreeRIDE before 2003 😉

-rich

> **···**
>
> On Tuesday, December 31, 2002, at 02:01 AM, Park Heesob wrote:
> 
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted  
> > from  
> > Python source code.
> > 
> > You can use win32\_popen3 like this:
> > 
> > require ‘win32\_popen’
> > 
> > fin,fout,ferr = IO.win32\_popen3(“date”)  
> > puts fout.gets  
> > fin.print “2002-01-01\n”  
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > fin,fout,ferr = IO.win32\_popen3(“irb”)
> > 
> > begin  
> > a = fout.getc  
> > putc a.chr  
> > end while a != ?\>
> > 
> > fin.print “exit\n”
> > 
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > You can download mswin binary for your Ruby version.  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
> > Souce code and binary included.
> > 
> > [Requirement]
> > 
> > - Ruby 1.6.5+
> > 
> > It may be made with other version but not verified.
> > 
> > [Install binary]
> > 
> > > ruby install.rb
> > 
> > [Install from source]
> > 
> > > ruby extconf.rb  
> > > nmake  
> > > ruby install.rb
> > 
> > [methods]
> > 
> > IO#win32\_popen2(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout).
> > 
> > IO#win32\_popen3(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout, child\_stderr).
> > 
> > IO#win32\_popen4(cmd[, mode]])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout\_and\_stderr).
> > 
> > Regards.
> > 
> > Park Heesob

---

<div class="post-metadata">

**Author:** ![Rich\_Kilmer](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rich\_Kilmer](https://rubytalk.org/u/Rich_Kilmer)\
**Post date:** [31 December 2002 16:35 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/5 "2002-12-31T16:35:31Z")

</div>

quick question on this library…how would one interrupt a running  
(popen’ed) process if it got hung up, etc?

-rich

> **···**
>
> On Tuesday, December 31, 2002, at 02:01 AM, Park Heesob wrote:
> 
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted  
> > from  
> > Python source code.
> > 
> > You can use win32\_popen3 like this:
> > 
> > require ‘win32\_popen’
> > 
> > fin,fout,ferr = IO.win32\_popen3(“date”)  
> > puts fout.gets  
> > fin.print “2002-01-01\n”  
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > fin,fout,ferr = IO.win32\_popen3(“irb”)
> > 
> > begin  
> > a = fout.getc  
> > putc a.chr  
> > end while a != ?\>
> > 
> > fin.print “exit\n”
> > 
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > You can download mswin binary for your Ruby version.  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
> > Souce code and binary included.
> > 
> > [Requirement]
> > 
> > - Ruby 1.6.5+
> > 
> > It may be made with other version but not verified.
> > 
> > [Install binary]
> > 
> > > ruby install.rb
> > 
> > [Install from source]
> > 
> > > ruby extconf.rb  
> > > nmake  
> > > ruby install.rb
> > 
> > [methods]
> > 
> > IO#win32\_popen2(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout).
> > 
> > IO#win32\_popen3(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout, child\_stderr).
> > 
> > IO#win32\_popen4(cmd[, mode]])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout\_and\_stderr).
> > 
> > Regards.
> > 
> > Park Heesob

---

<div class="post-metadata">

**Author:** ![Shashank\_Date3](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Shashank\_Date3](https://rubytalk.org/u/Shashank_Date3)\
**Post date:** [1 January 2003 01:24 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/6 "2003-01-01T01:24:29Z")

</div>

Park,

Thanks a lot for this package.

Unfortunately, when I compile it on my Windows XP Pro using VC++ 6.0 and run  
it with  
ruby 1.7.3 (2002-11-17) [i386-mswin32] it hangs after doing this:

> **···**
>
> * * *
> 
> C:\test\>ruby test.rb
> 
> test1  
> The current date is: Tue 12/31/2002  
> Enter the new date: (mm-dd-yy) 2002-01-01  
> The system cannot accept the date entered.
> 
> * * *
> 
> Please help.  
> Thanks and have a Very Happy New Year !
> 
> – shanko
> 
> “Park Heesob” [phasis@kornet.net](mailto:phasis@kornet.net) wrote in message  
> [news:auremp$s0b$1@news.hananet.net](mailto:news:auremp$s0b$1@news.hananet.net)…
> 
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> > Python source code.
> > 
> > You can use win32\_popen3 like this:
> > 
> > require ‘win32\_popen’
> > 
> > fin,fout,ferr = IO.win32\_popen3(“date”)  
> > puts fout.gets  
> > fin.print “2002-01-01\n”  
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > fin,fout,ferr = IO.win32\_popen3(“irb”)
> > 
> > begin  
> > a = fout.getc  
> > putc a.chr  
> > end while a != ?\>
> > 
> > fin.print “exit\n”
> > 
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > You can download mswin binary for your Ruby version.  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
> > Souce code and binary included.
> > 
> > [Requirement]
> > 
> > - Ruby 1.6.5+
> > 
> > It may be made with other version but not verified.
> > 
> > [Install binary]
> > 
> > > ruby install.rb
> > 
> > [Install from source]
> > 
> > > ruby extconf.rb  
> > > nmake  
> > > ruby install.rb
> > 
> > [methods]
> > 
> > IO#win32\_popen2(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout).
> > 
> > IO#win32\_popen3(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout, child\_stderr).
> > 
> > IO#win32\_popen4(cmd[, mode]])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout\_and\_stderr).
> > 
> > Regards.
> > 
> > Park Heesob

---

<div class="post-metadata">

**Author:** ![Park\_Heesob6](https://avatars.discourse-cdn.com/v4/letter/p/edb3f5/32.png) [@Park\_Heesob6](https://rubytalk.org/u/Park_Heesob6)\
**Post date:** [1 January 2003 15:45 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/7 "2003-01-01T15:45:37Z")

</div>

Hi,  
I added win32\_kill method to kill piped process, because  
Process.kill(“KILL”,pid) is failed on Ruby 1.6.8.

IO#win32\_kill(pid)  
Terminate the specified process id.

You can kill piped process like this:

fin,fout,ferr = IO.win32\_popen3(“date”)  
IO.win32\_kill(fin.pid) # fin.pid, fout.pid, ferr.pid → pid of piped  
process

# Process.kill(“KILL”,fin.pid) also available on Ruby v1.8.0

Regards.

Park Heesob

“Park Heesob” [phasis@kornet.net](mailto:phasis@kornet.net) wrote in message  
[news:auremp$s0b$1@news.hananet.net](mailto:news:auremp$s0b$1@news.hananet.net)…

> **···**
>
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> > Python source code.
> > 
> > You can download mswin binary for your Ruby version.  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
> > Souce code and binary included.
> > 
> > [Requirement]
> > 
> > - Ruby 1.6.5+
> > 
> > It may be made with other version but not verified.
> > 
> > [Install binary]
> > 
> > > ruby install.rb
> > 
> > [Install from source]
> > 
> > > ruby extconf.rb  
> > > nmake  
> > > ruby install.rb
> > 
> > [methods]
> > 
> > IO#win32\_popen2(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout).
> > 
> > IO#win32\_popen3(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout, child\_stderr).
> > 
> > IO#win32\_popen4(cmd[, mode]])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout\_and\_stderr).

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Martin\_DeMello1](https://rubytalk.org/u/Martin_DeMello1)\
**Post date:** [1 January 2003 20:05 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/8 "2003-01-01T20:05:55Z")

</div>

Wonderful!

martin

> **···**
>
> Park Heesob [phasis@kornet.net](mailto:phasis@kornet.net) wrote:
> 
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> > Python source code.

---

<div class="post-metadata">

**Author:** ![Ernest\_Ellingson1](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Ernest\_Ellingson1](https://rubytalk.org/u/Ernest_Ellingson1)\
**Post date:** [1 January 2003 20:25 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/9 "2003-01-01T20:25:59Z")

</div>

Thanks so much for developing this. I can put it to good use right now.  
I’ve done some experimenting with your code.  
I’m using ruby 1.66, so, some of what I’ve found may be due to that.

1. When using win32\_popen3 to pipe a ruby script you must use the command  
(“ruby.exe scriptname”) in order for both fin and fout to work properly.  
If you use the command(“scriptname”) the child script will run but fin  
doesn’t work properly. You get the following error in the child script  
Bad file descriptor (Errno::EBADF)

2. When using Marshal to pipe an object to a script the following doesn’t  
work (Marshal barks at it)  
Marshal.dump(some\_object, fin)

Thanks again for a slick piece of work.

Ernie  
“Park Heesob” [phasis@kornet.net](mailto:phasis@kornet.net) wrote in message  
[news:auremp$s0b$1@news.hananet.net](mailto:news:auremp$s0b$1@news.hananet.net)…

> **···**
>
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> > Python source code.
> > 
> > Regards.
> > 
> > Park Heesob

---

<div class="post-metadata">

**Author:** ![Ptkwt1](https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/32.png) [@Ptkwt1](https://rubytalk.org/u/Ptkwt1)\
**Post date:** [1 January 2003 22:26 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/10 "2003-01-01T22:26:10Z")

</div>

Though I don’t use Windows much anymore, this is good stuff.

This should be included in the standard Ruby distribution for  
Windows at some point.

Phil

In article [auremp$s0b$1@news.hananet.net](mailto:auremp$s0b$1@news.hananet.net),

> **···**
>
> Park Heesob [phasis@kornet.net](mailto:phasis@kornet.net) wrote:
> 
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> > Python source code.
> > 
> > You can use win32\_popen3 like this:
> > 
> > require ‘win32\_popen’
> > 
> > fin,fout,ferr = IO.win32\_popen3(“date”)  
> > puts fout.gets  
> > fin.print “2002-01-01\n”  
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > fin,fout,ferr = IO.win32\_popen3(“irb”)
> > 
> > begin  
> > a = fout.getc  
> > putc a.chr  
> > end while a != ?\>
> > 
> > fin.print “exit\n”
> > 
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > You can download mswin binary for your Ruby version.  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
> > Souce code and binary included.
> > 
> > [Requirement]
> > 
> > - Ruby 1.6.5+
> > 
> > It may be made with other version but not verified.
> > 
> > [Install binary]
> > 
> > > ruby install.rb
> > 
> > [Install from source]
> > 
> > > ruby extconf.rb  
> > > nmake  
> > > ruby install.rb
> > 
> > [methods]
> > 
> > IO#win32\_popen2(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout).
> > 
> > IO#win32\_popen3(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout, child\_stderr).
> > 
> > IO#win32\_popen4(cmd[, mode]])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout\_and\_stderr).
> > 
> > Regards.
> > 
> > Park Heesob
> 
> –  
> “Or perhaps the truth is less interesting than the facts?”  
> Amy Weiss (accusing [theregister.co.uk](http://theregister.co.uk) of engaging in ‘tabloid journalism’)  
> Senior VP, Communications  
> Recording Industry Association of America

---

<div class="post-metadata">

**Author:** ![Shashank\_Date3](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Shashank\_Date3](https://rubytalk.org/u/Shashank_Date3)\
**Post date:** [1 January 2003 23:26 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/11 "2003-01-01T23:26:23Z")

</div>

“Ernie” [erne@powernav.com](mailto:erne@powernav.com) wrote in message

> ```
> However, you can overcome this by
> data=Marshal.dump(some_object)
> fin.print data
> 
> on the client side you can retrieve the object
> some_obj=Marshal.load($stdin)
> 
> ```

Just curious … what client side ?  
Are you trying some kind of distributed ruby ?  
If yes, have you looked at drb on RAA ?

Would be interested in looking at your code.  
Thanks,

– shanko

---

<div class="post-metadata">

**Author:** ![Matt\_Scilipoti1](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@Matt\_Scilipoti1](https://rubytalk.org/u/Matt_Scilipoti1)\
**Post date:** [22 January 2003 19:08 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/12 "2003-01-22T19:08:42Z")

</div>

Sorry for the late reply. I am catching up on missed emails.  
The date format is incorrect. Asking for MM-dd-yy, it was sent yyyy-mm-dd.  
I think you should just change the test:  
fin.print “2002-01-01\n” to fin.print “01-01-02\n”

I prefer “01-13-02\n”, since it avoids the mm/dd confusion.

-matt

> **···**
>
> -----Original Message-----  
> From: Shashank Date [[mailto:sdate@kc.rr.com](mailto:sdate@kc.rr.com)]  
> Sent: Tuesday, December 31, 2002 8:24 PM  
> To: ruby-talk ML  
> Subject: Re: [ANN] win32\_popen 0.1
> 
> Park,
> 
> Thanks a lot for this package.
> 
> ## Unfortunately, when I compile it on my Windows XP Pro using VC++ 6.0 and run it with ruby 1.7.3 (2002-11-17) [i386-mswin32] it hangs after doing this:
> 
> C:\test\>ruby test.rb
> 
> test1  
> The current date is: Tue 12/31/2002  
> Enter the new date: (mm-dd-yy) 2002-01-01  
> The system cannot accept the date entered.
> 
> * * *
> 
> Please help.  
> Thanks and have a Very Happy New Year !
> 
> – shanko
> 
> “Park Heesob” [phasis@kornet.net](mailto:phasis@kornet.net) wrote in message  
> [news:auremp$s0b$1@news.hananet.net](mailto:news:auremp$s0b$1@news.hananet.net)…
> 
> > Hi, all.
> > 
> > win32\_popen is popen2,popen3,popen4 implementation on Windows adapted from  
> > Python source code.
> > 
> > You can use win32\_popen3 like this:
> > 
> > require ‘win32\_popen’
> > 
> > fin,fout,ferr = IO.win32\_popen3(“date”)  
> > puts fout.gets  
> > fin.print “2002-01-01\n”  
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > fin,fout,ferr = IO.win32\_popen3(“irb”)
> > 
> > begin  
> > a = fout.getc  
> > putc a.chr  
> > end while a != ?\>
> > 
> > fin.print “exit\n”
> > 
> > while !fout.eof  
> > puts fout.gets  
> > end
> > 
> > You can download mswin binary for your Ruby version.  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.6.8.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.6.8.zip)  
> > [http://home.nownuri.net/~phasis/popen/win32\_popen\_1.8.0.zip](http://home.nownuri.net/~phasis/popen/win32_popen_1.8.0.zip)  
> > Souce code and binary included.
> > 
> > [Requirement]
> > 
> > - Ruby 1.6.5+
> > 
> > It may be made with other version but not verified.
> > 
> > [Install binary]
> > 
> > > ruby install.rb
> > 
> > [Install from source]
> > 
> > > ruby extconf.rb  
> > > nmake  
> > > ruby install.rb
> > 
> > [methods]
> > 
> > IO#win32\_popen2(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout).
> > 
> > IO#win32\_popen3(cmd[, mode])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout, child\_stderr).
> > 
> > IO#win32\_popen4(cmd[, mode]])  
> > Executes cmd as a sub-process. Returns the file objects (child\_stdin,  
> > child\_stdout\_and\_stderr).
> > 
> > Regards.
> > 
> > Park Heesob

---

<div class="post-metadata">

**Author:** ![Ernest\_Ellingson1](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Ernest\_Ellingson1](https://rubytalk.org/u/Ernest_Ellingson1)\
**Post date:** [2 January 2003 00:26 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/13 "2003-01-02T00:26:42Z")

</div>

I called the child process the client side (my mistake). Its the process  
started with win32\_popen. Nothing special about it. I just wanted to see  
if I could load an object using it.  
I’m running windows XP pro and Ruby 1.66.  
I use drb in some of my applications. What’s nice about this code is that  
you can start a process feed it some data and then terminate the calling  
program without having to wait for the piped process to complete. For  
example, a cgi program that sends an email to the client. With threads or  
in the cgi code itself, the call to the mail server takes some time to  
complete. With popen, you can start a process to send the email. Finish  
writing the cgi output then exit the cgi program. The user gets the html  
response faster. You could use a drb object to do the same, but any method  
call on that object would have to complete before exiting the cgi program.  
Spawning a thread also requires waiting.

Ernie  
“Shashank Date” [sdate@kc.rr.com](mailto:sdate@kc.rr.com) wrote in message  
[news:9JKQ9.67172$Zt4.781743@twister.rdc-kc.rr.com](mailto:news:9JKQ9.67172$Zt4.781743@twister.rdc-kc.rr.com)…

> **···**
>
> > “Ernie” [erne@powernav.com](mailto:erne@powernav.com) wrote in message
> > 
> > > ```
> > > However, you can overcome this by
> > > data=Marshal.dump(some_object)
> > > fin.print data
> > > 
> > > on the client side you can retrieve the object
> > > some_obj=Marshal.load($stdin)
> > > 
> > > ```
> > 
> > Just curious … what client side ?  
> > Are you trying some kind of distributed ruby ?  
> > If yes, have you looked at drb on RAA ?
> > 
> > Would be interested in looking at your code.  
> > Thanks,
> > 
> > – shanko

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [23 January 2003 15:13 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/14 "2003-01-23T15:13:21Z")

</div>

Surely YYYY-MM-DD is the only intelligent date format. No confusion  
whatsoever. Since the Y2K fiasco, I’ve never seen any advantage in  
abbreviating the year, even in informal writing.

Gavin

> **···**
>
> On Thursday, January 23, 2003, 6:08:42 AM, Matt wrote:
> 
> > Sorry for the late reply. I am catching up on missed emails.  
> > The date format is incorrect. Asking for MM-dd-yy, it was sent yyyy-mm-dd.  
> > I think you should just change the test:  
> > fin.print “2002-01-01\n” to fin.print “01-01-02\n”
> 
> > I prefer “01-13-02\n”, since it avoids the mm/dd confusion.

---

<div class="post-metadata">

**Author:** ![Robert\_McGovern2](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@Robert\_McGovern2](https://rubytalk.org/u/Robert_McGovern2)\
**Post date:** [23 January 2003 16:22 UTC](https://rubytalk.org/t/ann-win32-popen-0-1/3868/15 "2003-01-23T16:22:02Z")

</div>

> Surely YYYY-MM-DD is the only intelligent date format. No confusion  
> whatsoever. Since the Y2K fiasco, I’ve never seen any advantage in  
> abbreviating the year, even in informal writing.

Agreed, I always use YYYY-MM-DD now and will always write the year out  
as YYYY on both formal & informal documents.

I’m working on the principle that if enough of us do it there won’t be a  
problem again in 97 years.

Rob
