From: "R.. Kumar 1.9.1 OSX" Date: 2010-07-06T14:20:24+09:00 Subject: Re: editing text using $EDITOR from program Caleb Clausen wrote: > On 6/28/10, R.. Kumar wrote: >> Does Highline or Thor/Facets/ActiveSupport etc have a method for when >> you want user to edit multiline text using the $EDITOR value? > > system("#{ed} #{temp.path}") > with > system(ed, temp.path) > > 2) I'd just read the whole file in one big slirp instead of line by > line. (Unless you think you're user is really going to write a whole > lot of stuff.... in which case you need to rewrite anyway.) Thanks a lot for your feedback. Could you give me some on this other issue. I am mailing some data to the user using the system "cat file | mail -s "title" me@email.com" format. I've used the system() for this and it works fine. I am doing a "cat" rather than "echo" since the data can have single or double quotes. Is it okay to use the system command this way, with a pipe inside it ? Looks clumsy to me! I looked back some old code of mine where i used "sendmail" and there I do: def pipe_output (str) pipeto = '/usr/sbin/sendmail -t' if pipeto != nil # i was taking pipeto from a hash, so checking proc = IO.popen(pipeto, "w+") proc.puts str proc.close_write #@main.log.info(proc.gets) end end This works fine, too. However, since "mail -s" requires both input, as well as some command line parameters (title and emailid), i was not clear whether this method would work. thx. -- Posted via http://www.ruby-forum.com/.