2

I have to run an executable file using ruby.How it is possible? Am using following code.also how can i check that file is executed or not

f = IO.popen("~/local/bin/test")

1 Answer 1

2

Use Ruby's Kernel#system method to run commands. This will return true if the command ran successfully and false otherwise:

system('~/local/bin/test')

Taken from here: http://mentalized.net/journal/2010/03/08/5_ways_to_run_commands_from_ruby/ There are other options, too. It depends whether you want to run it in the current process, create a sub-process, need to know the execution state etc.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.