I used the 'fork' event because it's easier than intercepting require
and this way it allows requiring but not using cluster.
If the subprocess does try { cluster.fork() } this won't crash, but
that's probably fine? Same if the subprocess has an 'uncaughtException'
handler.
Ex:
ā ./cmd.js cluster.js
š„ Profiling/home/goto-bus-stop/Code/nearform/0x/lib/preload/no-cluster.js:4
throw new Error('0x does not support clustering.')
^
Error: 0x does not support clustering.
at EventEmitter.cluster.on (/home/goto-bus-stop/Code/nearform/0x/lib/preload/no-cluster.js:4:9)
at EventEmitter.emit (events.js:182:13)
at emitForkNT (internal/cluster/master.js:226:11)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:266:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
š« Target subprocess error, code: 1
0x doesn't support multi processes.
I used the 'fork' event because it's easier than intercepting
require
and this way it allows requiring but not usingcluster
. If the subprocess doestry { cluster.fork() }
this won't crash, but that's probably fine? Same if the subprocess has an 'uncaughtException' handler.Ex: