开发者

Copying data from a running ruby script

I have a long running ruby script, in Lin开发者_运维知识库ux, which has some interesting data stored in a hash table. The program does not have any persistence mechanism and I am interested in copying the data from it's hash table. Is there any way to copy data from the memory of a running ruby script?

raj


It's not for the faint of heart, but there's a tool called Hijack that can give you a live irb prompt to a running ruby process. RubyInside has a very brief rundown and example of how to use it.


It would be very easy to add a signal handler that responds by dumping a serialized version of your hashtable.

See Signal.trap.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜