diff --git a/test/simple/test-cluster-eaccess.js b/test/simple/test-cluster-eaccess.js index 15da1f216ec..c87dfe83b3b 100644 --- a/test/simple/test-cluster-eaccess.js +++ b/test/simple/test-cluster-eaccess.js @@ -27,14 +27,28 @@ var path = require('path'); var fs = require('fs'); var net = require('net'); -// No win32 support so far -if (process.platform === 'win32') - return; - var socketPath = path.join(common.fixturesDir, 'socket-path'); if (cluster.isMaster) { - cluster.fork(); + var worker = cluster.fork(); + var gotError = 0; + worker.on('message', function(err) { + gotError++; + console.log(err); + if (process.platform === 'win32') + assert.strictEqual('EACCES', err.code); + else + assert.strictEqual('EADDRINUSE', err.code); + worker.disconnect(); + }); + process.on('exit', function() { + console.log('master exited'); + try { + fs.unlinkSync(socketPath); + } catch (e) { + } + assert.equal(gotError, 1); + }); } else { fs.writeFileSync(socketPath, 'some contents'); @@ -42,18 +56,7 @@ if (cluster.isMaster) { console.log('here'); }); - var gotError = 0; server.on('error', function(err) { - gotError++; - assert(/EADDRINUSE/.test(err.message)); - process.exit(); - }); - - process.on('exit', function() { - try { - fs.unlinkSync(socketPath); - } catch (e) { - } - assert.equal(gotError, 1); + process.send(err); }); }