Mongrel crashes while running 'exec' through ruby

Hi All,

I have a ruby on rails application and in the controller, I try to run a
shell script using exec command

like this

Hi All,

I have a ruby on rails application and in the controller, I try to run a
shell script using exec command

You know that the whole point of the exec command is that it replaces
the current process with what you tell it to run? You may be more
interested in ``, system or things like IO.popen

Fred

Frederick Cheung wrote:

Frederick Cheung wrote:
>> Hi All,

>> I have a ruby on rails application and in the controller, I try to run a
>> shell script using exec command

> You know that the whole point of the exec command is that it replaces
> the current process with what you tell it to run? You may be more
> interested in ``, system or things like IO.popen

> Fred

Thanks Fred, As far as i know system is for windows, and Currently my
application is deployed on linux.

That's not true

Can you tell me more about IO.popen ?

http://www.ruby-doc.org/core/classes/IO.html#M002267

Fred

Got the solution, exec starts a new process so don't use it..

just use the shell command in ruby like this

`sh /home/abc.sh`

in the controller..

It runs fine

Thanks Every body