From: Ethan Huo Date: 2011-03-31T23:18:48+09:00 Subject: how to refine the code to avoid using fork on windows? here is the thing, i need to move a previous ruby program from Linux to Windows, but Win doesn't support fork, how can i refine the code to make it work on Win? i googled a lot but still didn't get it, can anyone help me here?i paste the code below: def exec_cmd(cmd, toen=false, tmout=3600) return false if !$AveSubPID.nil? ret = fork if ret.nil? then exec "#{cmd}" end $AveSubPID = ret succ=true if (toen) then begin timeout(tmout) { Process.wait(ret) $AveSubPID = nil succ=$?.success? $AveErrno = $?.exitstatus } rescue Timeout::Error => e echo "(timeout) " kill_sub_process(ret) $AveSubPID = nil succ = false $AveErrno = $?.exitstatus end else Process.wait(ret) $AveSubPID = nil succ=$?.success? $AveErrno = $?.exitstatus end return succ end -- Posted via http://www.ruby-forum.com/.