From fd21b922e373831fd76b3ade0516d6b002f4a13f Mon Sep 17 00:00:00 2001 From: Oleg Elifantiev Date: Fri, 10 Apr 2015 00:37:16 +0300 Subject: [PATCH] Review notes fixed --- test/parallel/test-cluster-worker-disconnect.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-cluster-worker-disconnect.js b/test/parallel/test-cluster-worker-disconnect.js index 431fe716759581..4a059558a670a1 100644 --- a/test/parallel/test-cluster-worker-disconnect.js +++ b/test/parallel/test-cluster-worker-disconnect.js @@ -1,8 +1,6 @@ var common = require('../common'); var assert = require('assert'); var cluster = require('cluster'); -var fs = require('fs'); -var path = require('path'); if (cluster.isWorker) { var http = require('http'); @@ -10,9 +8,8 @@ if (cluster.isWorker) { }).listen(common.PORT, '127.0.0.1'); - // Save flag-file on disconnect cluster.worker.on('disconnect', function(){ - fs.writeFileSync(path.join(__dirname, process.pid + ''), ''); + process.exit(42); }); } else if (cluster.isMaster) { @@ -67,17 +64,10 @@ if (cluster.isWorker) { }); // Check that the worker died - worker.once('exit', function() { + worker.once('exit', function(code) { checks.worker.emitExit = true; checks.worker.died = !alive(worker.process.pid); - - var flagFile = path.join(__dirname, worker.process.pid + ''); - checks.worker.emitDisconnectInsideWorker = fs.existsSync(flagFile); - - // cleanup - if (checks.worker.emitDisconnectInsideWorker) { - fs.unlinkSync(flagFile); - } + checks.worker.emitDisconnectInsideWorker = code === 42; process.nextTick(function() { process.exit(0);