Rails request hangs when helper calls shell command
I have a helper in my rails 3.2.2 app that calls a shell script. The helper looks like this:
def revision
c = File.join(Rails.root, "script", "gitver")
`#{c}`.to_i
end
When I start the web server (either thin or webrick..i haven't tried any others) from within RubyMine, and I call this function from a view, the request never seems to go anywhere. I see nothing in the log and the browser just hangs, waiting. The behavior is the same in RubyMine 3.2.4 and in 4.x.
If I start the web server outside of RubyMine, there is no such problem.
It DOES have something to do with what the shell script is doing. The contents of the shell script are as follows:
/usr/local/git/bin/git shortlog | grep -E '^[ ]+\w+' | wc -l
..this returns a git commit number (somewhat).
If I change it to something simple (such as 'ls') the problem goes away.
RubyMine and command line (i.e. RVM) are both using the same ruby version (1.9.3-p125).
Any suggestions?
Please sign in to leave a comment.
Hello Mark,
what OS you are using? If you're using Mac OS X this can be caused by environment variables (such as PATH) handling. Please see this tip on how to setup environment variables to be picked up by RubyMine.
I am on OSX 10.6.8.
I installed the preference pane app and successfully added the same path that I have in terminal.
It didn't make any difference.
Is there some other environment variable that I need to set for RubyMine?
You need to logout and login again after you changed something in that preference pane. Have you done that?
Yes.