joyent/node — Issue #1850: fork() doesn't work in v0.5.8
Author: windyrobin
Created: 2011-10-10 11:32:10+00:00
State: open

the document :
http://nodejs.org/docs/v0.5.8/api/child_processes.html#child_process.fork

but when I write a test file :

var cp = require("child_process");
var util = require("util");
console.log(util.inspect(cp));
console.log("cp.fork :");
console.log(util.inspect(cp.fork));

and I run it using : node fork.js

the result is :

{ exec: [Function], execFile: [Function], spawn: [Function] }
cp.fork :
undefined

And I check the child_process_uv.js and find no exported "fork" method ,

so I use the cmd : node --use-legacy fork.js

node.js:207
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot call method 'unref' of undefined
at EventEmitter.stdout (node.js:238:26)
at Object. (console.js:26:10)
at Object. (/home/ntest/fork.js:4:9)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array. (module.js:470:10)
at EventEmitter._tickCallback (node.js:199:26)

it crashed !!!!

why?