worker.isDead()

worker.isDead() This function returns true if the worker's process has terminated (either because of exiting or being signaled). Otherwise, it returns false.

worker.kill()

worker.kill([signal='SIGTERM']) signal <String> Name of the kill signal to send to the worker process. This function will kill the worker. In the master, it does this by disconnecting the worker.process, and once disconnected, killing with signal. In the worker, it does it by disconnecting the channel, and then exiting with code 0. Causes .suicide to be set. This method is aliased as worker.destroy() for backwards compatibility. Note that in a worker, process.kill() exists, but it i

worker.id

worker.id <Number> Each new worker is given its own unique id, this id is stored in the id. While a worker is alive, this is the key that indexes it in cluster.workers

Worker

Class: Worker A Worker object contains all public information and method about a worker. In the master it can be obtained using cluster.workers. In a worker it can be obtained using cluster.worker.

vm.runInThisContext()

vm.runInThisContext(code[, options]) vm.runInThisContext() compiles code, runs it and returns the result. Running code does not have access to local scope, but does have access to the current global object. Example of using vm.runInThisContext() and eval() to run the same code: const vm = require('vm'); var localVar = 'initial value'; const vmResult = vm.runInThisContext('localVar = "vm";'); console.log('vmResult: ', vmResult); console.log('localVar: ', localVar); const evalResult = eval('l

watcher.close()

watcher.close() Stop watching for changes on the given fs.FSWatcher.

worker.disconnect()

worker.disconnect() In a worker, this function will close all servers, wait for the 'close' event on those servers, and then disconnect the IPC channel. In the master, an internal message is sent to the worker causing it to call .disconnect() on itself. Causes .suicide to be set. Note that after a server is closed, it will no longer accept new connections, but connections may be accepted by any other listening worker. Existing connections will be allowed to close as usual. When no more conne

vm.runInNewContext()

vm.runInNewContext(code[, sandbox][, options]) vm.runInNewContext() compiles code, contextifies sandbox if passed or creates a new contextified sandbox if it's omitted, and then runs the code with the sandbox as the global object and returns the result. vm.runInNewContext() takes the same options as vm.runInThisContext(). Example: compile and execute code that increments a global variable and sets a new one. These globals are contained in the sandbox. const util = require('util'); const vm =

vm.runInContext()

vm.runInContext(code, contextifiedSandbox[, options]) vm.runInContext() compiles code, then runs it in contextifiedSandbox and returns the result. Running code does not have access to local scope. The contextifiedSandbox object must have been previously contextified via vm.createContext(); it will be used as the global object for code. vm.runInContext() takes the same options as vm.runInThisContext(). Example: compile and execute different scripts in a single existing context. const util = r

vm.runInDebugContext()

vm.runInDebugContext(code) vm.runInDebugContext() compiles and executes code inside the V8 debug context. The primary use case is to get access to the V8 debug object: const Debug = vm.runInDebugContext('Debug'); Debug.scripts().forEach(function(script) { console.log(script.name); }); Note that the debug context and object are intrinsically tied to V8's debugger implementation and may change (or even get removed) without prior warning. The debug object can also be exposed with the --expose_de