IOWA -- another newbie question

M

Mark Probert

What is the best way of running an external script and returning the
results from within IOWA?

I have been doing the

@output = %x(ruby my_script)

and getting nowhere (the "ruby my_script" works correctly from the command
line).

I assume that I need to use a cgi-bin wrapper or similar?
 
K

Kirk Haines

What is the best way of running an external script and returning the
results from within IOWA?

I have been doing the

@output = %x(ruby my_script)

and getting nowhere (the "ruby my_script" works correctly from the
command line).

I assume that I need to use a cgi-bin wrapper or similar?

There should be no difference between running an external script from within
an IOWA app and any other Ruby program.

So, if %x(ruby my_script) is not working, my guess is that it is either
because the PATH of the IOWA process doesn't have ruby in it, or my_script
is not in the current working directory of the process.

Your safest bet is to explicitly specify the path to your ruby executable
and the path to your script.

Something like this:

ruby = File::join:):Config::CONFIG['bindir'],
::Config::CONFIG['ruby_install_name'])
ruby << ::Config::CONFIG['EXEEXT']
@output = %x(#{ruby} /path/to/my_script)
 
M

Mark Probert

Hi, Kirk.

Kirk Haines said:
So, if %x(ruby my_script) is not working, my guess is that it is
either because the PATH of the IOWA process doesn't have ruby in it,
or my_script is not in the current working directory of the process.
The script %x(foo) does work -- sorry for the confusion.

It is triggered from a mixin library in ../lib relative to the app:

webif/
lib/ <-- required mixin lib here with run() command
hcweb/ <-- ruby -I ../lib ./hcweb.rb
Admin/
Run/ <-- Triggering page for the run()

How can I make this work?

Thanks for your patience!
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,413
Latest member
KeiraLight

Latest Threads

Top