node.js - Editing NodeJS file while it is executing -


this should trivial question. have pretty file, foo.js. run node foo.js. runs , runs , runs. while still running, open favorite text editor , edit foo.js, adding whole lot of errors code.

can sure won't affect current execution of foo.js? right when assume file read @ beginning of execution, , there no need read again since kept in memory? or edit file cause when executing?

the node.js code model initial file specify on command line such node foo.js that, @ startup, foo.js read disk, parsed javascript byte code , executed. functions or variables define in file kept in memory on. there no circumstance node.js will, entirely on own, reread foo.js.

some potential places reread are:

  1. if have specific code refers foo.js on disk such require() statement or code reads disk.

  2. if use auto-restart tools such forever. in case, if process crashes , forever restarts it, read fresh copy of foo.js during restart.

  3. if fork, spawn or exec own process. note happen in forms of dynamic clustering or types of code start new process in circumstances.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -