eventmachine and external scripts via backticks

Posted by Maciek on Stack Overflow See other posts from Stack Overflow or by Maciek
Published on 2010-02-08T20:21:39Z Indexed on 2010/04/11 13:43 UTC
Read the original article Hit count: 389

I have a small HTTP server script I've written using eventmachine which needs to call external scripts/commands and does so via backticks (``). When serving up requests which don't run backticked code, everything is fine, however, as soon as my EM code executes any backticked external script, it stops serving requests and stops executing in general.

I noticed eventmachine seems to be sensitive to sub-processes and/or threads, and appears to have the popen method for this purpose, but EM's source warns that this method doesn't work under Windows. Many of the machines running this script are running Windows, so I can't use popen.

Am I out of luck here? Is there a safe way to run an external command from an eventmachine script under Windows? Is there any way I could fire off some commands to be run externally without blocking EM's execution?

edit: the culprit that seems to be screwing up EM the most is my usage of the Windows start command, as in: start java myclass. The reason I'm using start is because I want those external scripts to start running and keep running after the EM request is served

© Stack Overflow or respective owner

Related posts about ruby

Related posts about eventmachine