System Calls

Hello,

I have written a ruby file that starts a new webrick server from an
existing project. When I call this file, the webrick server will start
correctly.

However, when I insert the exact same code inside a fork in a controller
method in another rails project, and that code runs, it doesn’t start
the server correctly.

I’ve actually noticed this previously. I can write a ruby program that
will do system() calls to grab certain info about running processes, but
when I try to do the same thing inside a controller method in an
existing rails project, the code doesn’t return anything. Any idea what
might be causing the code inside the rails project to break?

Don’t do that kind of stuff in a Rails controller. There’s a lot of
magic underneath and forking can do strange things to your app if it
doesn’t break it completely.

Check out the Backgroundrb plugin for this.

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs