mirror of
https://github.com/davidmarkclements/0x.git
synced 2026-01-25 14:47:55 +00:00
0x doesn't support it.
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
```
6 lines
119 B
JavaScript
6 lines
119 B
JavaScript
const cluster = require('cluster')
|
|
|
|
cluster.on('fork', () => {
|
|
throw new Error('0x does not support clustering.')
|
|
})
|