Method: RubyCurses::TextView#pipe_output
- Defined in:
- lib/rbcurse/core/widgets/rtextview.rb
#pipe_output(pipeto, str) ⇒ Object
returns array of lines after running command on string passed TODO: need to close pipe other’s we’ll have a process lying around forever.
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/rbcurse/core/widgets/rtextview.rb', line 675 def pipe_output (pipeto, str) case str when String #str = str.split "\n" # okay when Array str = str.join "\n" end #pipeto = '/usr/sbin/sendmail -t' #pipeto = %q{mail -s "my title" rahul} if pipeto != nil # i was taking pipeto from a hash, so checking proc = IO.popen(pipeto, "w+") proc.puts str proc.close_write proc.readlines end end |