Re: [nodejs] Re: Unloading a module from require

2012-06-15 Thread Dominic Tarr
what you _could_ do, is instrument the code by parsing and inserting additional calls. with this technique you can add counters that make it safe to run untrusted code. so you can prevent things like: while (true); which would loop forever. you could also use this technique to abort any io

[nodejs] Re: Unloading a module from require

2012-06-14 Thread Ben
I'm interested in this question too. I tried it once, but all the async operations started by the modules remained active even after unloading it. Try for example a simple setInterval() that writes something to the log every second, in the module - when you unload the module, the timer is

Re: [nodejs] Re: Unloading a module from require

2012-06-14 Thread yogesh agrawal
delete require.cache is not good way to unload. Some times module doesn't get unloaded after deleting it from cache. Modules api lacks unload method :( On Thu, Jun 14, 2012 at 11:28 AM, Ben thebucks...@gmail.com wrote: I'm interested in this question too. I tried it once, but all the async

Re: [nodejs] Re: Unloading a module from require

2012-06-14 Thread Dan Milon
What is the use case of unloading a module? On 06/14/2012 10:02 AM, yogesh agrawal wrote: delete require.cache is not good way to unload. Some times module doesn't get unloaded after deleting it from cache. Modules api lacks unload method :( On Thu, Jun 14, 2012 at 11:28 AM, Ben

Re: [nodejs] Re: Unloading a module from require

2012-06-14 Thread rubyonrailsx
Does this mean NodeJs can change its code on-the-fly? -- rubyonrailsx Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Thursday, June 14, 2012 at 3:02 PM, yogesh agrawal wrote: delete require.cache is not good way to unload. Some times module doesn't get unloaded after deleting

Re: [nodejs] Re: Unloading a module from require

2012-06-14 Thread Matt
Of course it does. It's a dynamic language. You can redefine any function at any time. On Thu, Jun 14, 2012 at 3:08 AM, rubyonrailsx rubyonrai...@gmail.comwrote: Does this mean NodeJs can change its code on-the-fly? -- rubyonrailsx Sent with Sparrow http://www.sparrowmailapp.com/?sig On

Re: [nodejs] Re: Unloading a module from require

2012-06-14 Thread mgutz
In our case, our xml builder like templates are javascript modules loaded via require. Templates in development mode should not be cached. `delete require.cache` works for us. On Thursday, June 14, 2012 1:12:20 AM UTC-7, Dan Milon wrote: What is the use case of unloading a module? On

[nodejs] Re: Unloading a module from require

2012-06-13 Thread darcy
delete require.cache[the_absolute path_of_module]; is it what you want? On Thursday, June 14, 2012 3:40:55 AM UTC+8, Andrew Finnell wrote: I did some research in the group and it appears someone had a similar question about unloading modules that were loaded with require. Am I correct in