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.
364025223fa593e2e76111b31d76f406?d=identicon&s=25 Piet Hadermann (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
538fa89682589ea480d524756fa0841d?d=identicon&s=25 Peter Ertl (Guest)
on 2007-01-23 17:47
(Received via mailing list)


%x{ls -l /}

2007/1/23, Piet Hadermann <>:
A0bae8a464f7bdae361c4a07e4f84cd8?d=identicon&s=25 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.