Forum: Ruby on Rails Re: Execute shell command from Rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B0cd75994ee6d86805b83db20900f984?d=identicon&s=25 Piet H. (piet)
on 2007-01-23 16:19
(Received via mailing list)
Hi Chuong,

I've used 'open3' repeatedly
with succes.
(used open3 because I needed stdout and stderr)



[] On Behalf Of Chuong Huynh
  Sent: dinsdag 23 januari 2007 11:19
  Subject: [Rails] Execute shell command from Rails

  Hi all,

  Can anyone tell what is the way to execute OS shell command from
within Rails programs? I tried to use "exec" but it terminate the
console (which run "ruby script/server" originally).

  Thank you very much.

  - Chuong
Peter Ertl (Guest)
on 2007-01-23 17:47
(Received via mailing list)


%x{ls -l /}

2007/1/23, Piet Hadermann <>:
Chuong Huynh (Guest)
on 2007-01-23 18:11
(Received via mailing list)

Thank you for the info. I've found out also Kernel.system, IO.popen. I
try them all.

- Chuong
This topic is locked and can not be replied to.