2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2015-12-23 16:02:12 -08:00
|
|
|
require('../common');
|
2012-05-31 21:23:05 -07:00
|
|
|
var assert = require('assert');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var spawn = require('child_process').spawn;
|
2015-05-19 13:00:06 +02:00
|
|
|
var childPath = path.join(__dirname, '..', 'fixtures',
|
|
|
|
'parent-process-nonpersistent.js');
|
2012-05-31 21:23:05 -07:00
|
|
|
var persistentPid = -1;
|
2012-05-31 21:23:05 -07:00
|
|
|
|
2012-05-31 21:23:05 -07:00
|
|
|
var child = spawn(process.execPath, [ childPath ]);
|
|
|
|
|
2015-05-19 13:00:06 +02:00
|
|
|
child.stdout.on('data', function(data) {
|
2012-05-31 21:23:05 -07:00
|
|
|
persistentPid = parseInt(data, 10);
|
2012-05-31 21:23:05 -07:00
|
|
|
});
|
|
|
|
|
2015-05-19 13:00:06 +02:00
|
|
|
process.on('exit', function() {
|
2012-05-31 21:23:05 -07:00
|
|
|
assert(persistentPid !== -1);
|
2015-05-19 13:00:06 +02:00
|
|
|
assert.throws(function() {
|
2012-05-31 21:23:05 -07:00
|
|
|
process.kill(child.pid);
|
|
|
|
});
|
2015-05-19 13:00:06 +02:00
|
|
|
assert.doesNotThrow(function() {
|
2012-05-31 21:23:05 -07:00
|
|
|
process.kill(persistentPid);
|
|
|
|
});
|
2012-05-31 21:23:05 -07:00
|
|
|
});
|
|
|
|
|