From: Caleb Clausen Date: 2010-06-01T03:00:58+09:00 Subject: Re: Interrupting the evaluation of a ruby script On 5/31/10, Emmanuel Emmanuel wrote: > Caleb Clausen wrote: >> bypass your timeout. If you put user code in a separate process, it >> would be somewhat harder for them to bypass the timeout, but I think >> still possible. > > Sure ! I 100% agree ! > Now the big question (that I don't know the answer) is how do I > interrupt the evaluation of > a ruby script from another process ?? (and I want somthing that works on > all platforms ....) > > If you know the answer to that, please let me know (and I don't want to > just kill the process, I want to interrupt the evaluation) What is the difference between 'kill' and 'interrupt'? Do you mean by 'interrupt' that you want to stop the process and then potentially start it again where it left off? If you're going to put the user code in another process, the kill syscall is almost certainly what you'll need to use to 'interrupt' it, whatever that means. kill is sort of misnamed... it's the syscall to send a signal to another process. Typically, this stops execution and closes the process down, but you can intercept it and you can do whatever you like. Try the following commands if you have linux to see some relevant documentation: man 1 kill man 2 kill man 2 signal If stopping and restarting the process is what you want, you might get some good mileage out of the STOP and CONT signals.