IO.popen("-") : IO.popen « File Directory « Ruby






IO.popen("-")


IO.popen("-") do |mypipe|
  if mypipe
    puts "I'm the parent: pid = #{Process.pid}"
    listen = mypipe.gets
    puts listen
  else
    puts "I'm the child: pid = #{Process.pid}"
  end
end


 








Related examples in the same category

1.you open up an I/O stream with dir
2.open a program with a read/write I/O stream and handle data in both directions
3.Open a file and write string into it