# File lib/session.rb, line 616 def spawn command ipath = tmpfifo opath = tmpfifo epath = tmpfifo cmd = "#{ command } < #{ ipath } 1> #{ opath } 2> #{ epath } &" system cmd i = open ipath, 'w' o = open opath, 'r' e = open epath, 'r' [i,o,e] end
# File lib/session.rb, line 630 def tmpfifo path = nil 42.times do |i| tpath = File::join(Dir::tmpdir, "#{ $$ }.#{ rand }.#{ i }") v = $VERBOSE begin $VERBOSE = nil system "mkfifo #{ tpath }" ensure $VERBOSE = v end next unless $? == 0 path = tpath at_exit{ File::unlink(path) rescue STDERR.puts("rm <#{ path }> failed") } break end raise "could not generate tmpfifo" unless path path end