开发者

How could I pack a rack web-application includes infinite loop

开发者 https://www.devze.com 2023-04-08 03:49 出处:网络
I want to pack a rack web-application in order to distribute it, In which a infinite loop resides. So it won\'t stop until my ctr开发者_如何学Pythonl-c. But it seems ocra will only pack it when it end

I want to pack a rack web-application in order to distribute it, In which a infinite loop resides. So it won't stop until my ctr开发者_如何学Pythonl-c. But it seems ocra will only pack it when it ends 'naturally', and ctrl-c stopped the process.

have been tring use exit or abort in callmethod of object being passed to rake. after which the whole process do not end, some trace info appears though.

it is possible to invoke rake.run in a thread, and end application after given time. But I do not want to distribute a suicide version. so is there some more eligible and controllable way to normally end it ?

not sure if this is a insane question, but thanks in advance.


According to the OCRA docu, OCRA sets an environment variable OCRA_EXECUTABLE when being run.

So you could check for that environment var in your code and break the loop if OCRA is running, e.g.:

 while true
   break if ENV.has_key? 'OCRA_EXECUTABLE'
   ...
 end
0

精彩评论

暂无评论...
验证码 换一张
取 消