Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-child-process-detached.js « parallel « test - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1cc2a5022ed49a30355a1792f408a031a3abf6ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var common = require('../common');
var assert = require('assert');
var path = require('path');

var spawn = require('child_process').spawn;
var childPath = path.join(__dirname, '..', 'fixtures', 'parent-process-nonpersistent.js');
var persistentPid = -1;

var child = spawn(process.execPath, [ childPath ]);

child.stdout.on('data', function (data) {
  persistentPid = parseInt(data, 10);
});

process.on('exit', function () {
  assert(persistentPid !== -1);
  assert.throws(function () {
    process.kill(child.pid);
  });
  assert.doesNotThrow(function () {
    process.kill(persistentPid);
  });
});