From: Emmanuel Emmanuel Date: 2010-06-01T03:12:58+09:00 Subject: Re: Interrupting the evaluation of a ruby script Caleb Clausen wrote: > On 5/31/10, Emmanuel Emmanuel wrote: >> >> 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? Nope. Kill is killing the process Interrupt would be like raising an exception in the ruby code .... (with threads, if I do the eval in a thread, if I terminate this thread, the toplevel environment of ruby is still there) > 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: Ok, if you want I want to intercept the "kill" and not terminate the process > > man 1 kill > man 2 kill > man 2 signal > I understood that signals don't work on windows .... The only one it seems to understand is kill, and I can't intercept it .. it seems to be a well known problem > If stopping and restarting the process is what you want, you might get > some good mileage out of the STOP and CONT signals. pretty sure Windows does not know about those.... EMmanuel -- Posted via http://www.ruby-forum.com/.