[Win32utils-devel] FW: problem with win32 waitpid

win32utils-devel at rubyforge.org win32utils-devel at rubyforge.org
Thu Nov 18 08:10:26 EST 2004

Forward from Laurent Julliiard.  Any suggestions anyone?


>From: Laurent Julliard <Laurent.Julliard at xrce.xerox.com>
>Reply-To: laurent at moldus.org
>To: djberg96 at hotmail.com
>Subject: problem with win32 waitpid
>Date: Thu, 18 Nov 2004 08:49:51 +0100
>I am one of the developer of the FreeRIDE project (the Ruby IDE) and
>I'm in charge of the FreeRIDE debugger with which we have had a
>number of problems on Windows now mostly due to the "clunky"
>implementation of IO/Process/Signal stuff on Win32.
>I recently came across your Win32 utils package and investigated the
>use of win32 process as a replacement for the native Ruby
>implementation. I currently have a problem which is the following:
>Somewhere in my code I have this:
>require 'win32/process'
>command = "start CMD /K ruby -e 'while true { sleep 0.1; }'"
>@inp = @out = IO.popen(command,"w+") # this is the regular 
>#.... getting the pid of the ruby process (pid variable)
>puts "Process stopped"
>When I run this code I always get the following error:
>waitpid: no child process (Process::Win32::ProcessError)
>I suspect that the reason for that is because the command I run
>actually starts a CMD.exe program which in turn starts a ruby
>program.  The waitpid call operates on the pid of the ruby program
>which is not the child but the grand-child of the current process.
>If I use the standard Ruby waitpid it works well.
>Do you see how I can solve this problem? Shall I use Process.create
>with CREATE_NEW_CONSOLE flag instead of the IO.popen method? Would
>this work better?
>Any advice is welcome
>Thanks for your help
>Xerox Global Services
>Manager, Smart Document Engineering
>Tel: +33 (0)4 76 61 50 48
>Fax: +33 (0)4 76 61 51 99

More information about the win32utils-devel mailing list