How to run a terminal command from a Ruby app?

V

Victor Martin

Hi there.

I'm using Ruby and the great Processing implementation made for Ruby
(http://github.com/jashkenas/ruby-processing/wikis). The "problem" is
that if you need to run anything of Ruby-Processing, you need to write:

#rp5 run app.rb

Instead of #ruby app.rb

So, what I need is executing the "rp5 run" command from another ruby
application, since I'm generating the Processing document in another
Ruby app which does not use Ruby-Processing.

I'm running Ruby from Mac Os X. Any idea?
 
K

Kyle Schmitt

system("rp5 run foo")
or, if you need the output what you ran,
foo=%x{rp5 run foo}
# note, you can use most paired symbols, like () [] <>, or quotes "" '',
#with %x, not just {}

--Kyle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top