From 80df9e72de5e28fbc626f66c432b8e355d056b64 Mon Sep 17 00:00:00 2001 From: Robert Jefe Lindstaedt Date: Fri, 6 May 2016 12:05:04 +0200 Subject: [PATCH] child_process: revert exposing child process constructor The constructor blocks a rewrite of child process behind require('child_process').ChildProcess, which would be a deprecation or legacy friendly way. Also exposing was not a good decision in general and rather fell through code review with bigger changes. --- lib/child_process.js | 2 +- .../test-async-wrap-check-providers.js | 3 --- .../test-child-process-constructor.js | 25 ------------------- 3 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 test/parallel/test-child-process-constructor.js diff --git a/lib/child_process.js b/lib/child_process.js index 81fb8c1fcd0fe8..17813900239292 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -14,7 +14,7 @@ const child_process = require('internal/child_process'); const errnoException = util._errnoException; const _validateStdio = child_process._validateStdio; const setupChannel = child_process.setupChannel; -const ChildProcess = exports.ChildProcess = child_process.ChildProcess; +const ChildProcess = child_process.ChildProcess; exports.fork = function(modulePath /*, args, options*/) { diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js index 4b5447b82cbfab..19fd4373a7f2cf 100644 --- a/test/parallel/test-async-wrap-check-providers.js +++ b/test/parallel/test-async-wrap-check-providers.js @@ -9,7 +9,6 @@ const fs = require('fs'); const net = require('net'); const tls = require('tls'); const zlib = require('zlib'); -const ChildProcess = require('child_process').ChildProcess; const StreamWrap = require('_stream_wrap').StreamWrap; const HTTPParser = process.binding('http_parser').HTTPParser; const async_wrap = process.binding('async_wrap'); @@ -105,8 +104,6 @@ function checkTLS() { zlib.createGzip(); -new ChildProcess(); - new HTTPParser(HTTPParser.REQUEST); process.on('exit', function() { diff --git a/test/parallel/test-child-process-constructor.js b/test/parallel/test-child-process-constructor.js deleted file mode 100644 index 6980810485c964..00000000000000 --- a/test/parallel/test-child-process-constructor.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -require('../common'); -var assert = require('assert'); -var child_process = require('child_process'); -var ChildProcess = child_process.ChildProcess; -assert.equal(typeof ChildProcess, 'function'); - -// test that we can call spawn -var child = new ChildProcess(); -child.spawn({ - file: process.execPath, - args: ['--interactive'], - cwd: process.cwd(), - stdio: 'pipe' -}); - -assert.equal(child.hasOwnProperty('pid'), true); - -// try killing with invalid signal -assert.throws(function() { - child.kill('foo'); -}, /Unknown signal: foo/); - -assert.equal(child.kill(), true);