From: Chuck Remes Date: 2010-08-31T02:29:27+09:00 Subject: Re: fork() function is unimplemented on this machine On Aug 30, 2010, at 11:47 AM, Ralph Shnelvar wrote: > I am trying to implement the code on page 181 of *Programming Ruby 1.9* > > The code on that page reads > > - - - > trap("CLD") do > pid = Process.wait > puts "Child pid #{pid}: terminated > end > fork { exec("sort testfile >output.txt") } > - - - > > > When I attempt to run similar code I first get that > unsupported signal SIGCLD > > I tried SIGCHLD ... same problem. > > Signals.list generates > {"SEGV"=>11, "KILL"=>9, "TERM"=>15, "INT"=>2, "FPE"=>8, "ABRT"=>22, "ILL"=>4, "EXIT"=>0} > > So I next tried > > - - - > trap("EXIT") do > pid = Process.wait > puts "Child pid #{pid}: terminated > end > fork { exec("sort testfile >output.txt") } > - - - > > and that's when I get the msg > fork() function is unimplemented on this machine > > > > Is fork truly not implemented for 1.8.6 and Windows? As far as I know, Windows does not support fork. > How can I execute (spawn) an external program in 1.8.6 and know when the program is finished? For one, upgrade to Ruby 1.9.1 or 1.9.2 at minimum. After doing so, check out Kernel#spawn. http://ruby-doc.org/ruby-1.9/classes/Kernel.src/M002642.html This code is supported under Windows. > here are the various signals for ruby documented? I don't know. cr