Jin Lee
2006-Aug-08 17:39 UTC
[Rails] off topic: running non-ruby programs through command line
Hi all, Slightly OT, but is there any way to run command-line programs through Ruby? I have a rails web application that performs some database work. After a certain action is performed, the rails app should then call a java program that performs additional work to our mainframe. This is under Win 2003 Server. Any ideas? Thanks, Jin Lee -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060808/b1b383a5/attachment.html
John Anderson
2006-Aug-08 18:21 UTC
[Rails] off topic: running non-ruby programs through command line
On Tue, 2006-08-08 at 10:26 -0700, Jin Lee wrote:> Hi all, > > Slightly OT, but is there any way to run command-line programs through > Ruby? I have a rails web application that performs some database work. > After a certain action is performed, the rails app should then call a > java program that performs additional work to our mainframe. This is > under Win 2003 Server.You can probably use system(...) see Kernel.system for docs. Or backticks `java -jar whatever.jar` bye John
Dr Nic
2006-Aug-08 18:28 UTC
[Rails] Re: off topic: running non-ruby programs through command lin
I think %x{ command } does this -- Posted via http://www.ruby-forum.com/.
Romeu Henrique Capparelli Fonseca
2006-Aug-08 23:56 UTC
RES: [Rails] off topic: running non-ruby programs through command line
Hi. It''s not a good idea, IMHO, to call an external app on a http session. You will hang your session unless you work with threads / forks. A good way is: - Drop a file on a directory with all parameters you need. - Create an robot that reads the directory from time to time and calls your java app with parameters is file. -- Before calling the java app is good to move the dropped file to avoid getting the same file several times. This is ok if you need it asynchronous. []''s Romeu Fonseca -----Mensagem original----- De: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] Em nome de Jin Lee Enviada em: ter?a-feira, 8 de agosto de 2006 13:26 Para: rails@lists.rubyonrails.org Assunto: [Rails] off topic: running non-ruby programs through command line Hi all, Slightly OT, but is there any way to run command-line programs through Ruby? I have a rails web application that performs some database work. After a certain action is performed, the rails app should then call a java program that performs additional work to our mainframe. This is under Win 2003 Server. Any ideas? Thanks, Jin Lee -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/8/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 7/8/2006
Michael Siebert
2006-Aug-09 06:37 UTC
[Rails] off topic: running non-ruby programs through command line
2006/8/8, Romeu Henrique Capparelli Fonseca <rfonseca@fpf.br>:> > Hi. > It''s not a good idea, IMHO, to call an external app on a http session. You > will hang your session unless you work with threads / forks. > > A good way is: > > - Drop a file on a directory with all parameters you need. > - Create an robot that reads the directory from time to time and calls > your java app with parameters is file. > -- Before calling the java app is good to move the dropped file to avoid > getting the same file several times.another way: use the backgrounDRb plugin. so you can even make cron-like things, status reporting back to the app, etc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060809/74e56f22/attachment.html
Piet Hadermann
2006-Aug-09 08:56 UTC
[Rails] off topic: running non-ruby programs through command line
A while ago I used Open3.popen3 (because I needed stdout and stderr) to execute some commands on a vms system through rsh. Since this functionality is only used occasionally (in an internal app), working with threads and implementing callback etc would have been overkill imho. Piet. -----Original Message----- From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Michael Siebert Sent: woensdag 9 augustus 2006 8:36 To: rails@lists.rubyonrails.org Subject: Re: [Rails] off topic: running non-ruby programs through command line 2006/8/8, Romeu Henrique Capparelli Fonseca <rfonseca@fpf.br>: Hi. It''s not a good idea, IMHO, to call an external app on a http session. You will hang your session unless you work with threads / forks. A good way is: - Drop a file on a directory with all parameters you need. - Create an robot that reads the directory from time to time and calls your java app with parameters is file. -- Before calling the java app is good to move the dropped file to avoid getting the same file several times. another way: use the backgrounDRb plugin. so you can even make cron-like things, status reporting back to the app, etc -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060809/8d5f13dc/attachment.html