[Win32utils-devel] Win32::Process fork fragility

win32utils-devel@rubyforge.org
Sun, 15 Feb 2004 17:50:36 -0000

Park,

I was just playing around with the Process.fork/wait that you committed.  I
discovered that it''s rather easy to break with this:

require "win32/process"
include Win32

Dir.chdir ".." # This causes the problem

pid = Win32::Process.fork

if pid == 0
	puts "In the child"
	exit
else
	puts "In the parent"
end

Win32::Process.wait(pid)

I think the problem lies in this code:

fname = rb_gv_get("$0");
...
path = rb_file_s_expand_path(1, &fname);

I think I solved this problem by declaring fname and path at the top of the
process.c file and then moving those two lines into the Init_process()
function.  It worked in testing anyway.

Shall I commit?

Regards,

Dan

_________________________________________________________________
Get some great ideas here for your sweetheart on Valentine''s Day - and
beyond. http://special.msn.com/network/celebrateromance.armx