From 212de3c5ec429a580d2e79ce3c2516b93b52b8f5 Mon Sep 17 00:00:00 2001 From: Weijia Wang <381152119@qq.com> Date: Sat, 7 Oct 2017 22:50:42 +0800 Subject: lib: use destructuring for some constants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change is to unify the declaration for constants into using destructuring on the top-level-module scope, reducing some redundant code. PR-URL: https://github.com/nodejs/node/pull/16063 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Tobias Nießen Reviewed-By: Ruben Bridgewater Reviewed-By: Gibson Fahnestock --- lib/child_process.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/child_process.js') diff --git a/lib/child_process.js b/lib/child_process.js index fc538343f1..3bf3b23a1c 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -27,15 +27,17 @@ const { isUint8Array } = require('internal/util/types'); const { createPromise, promiseResolve, promiseReject } = process.binding('util'); const debug = util.debuglog('child_process'); - -const Buffer = require('buffer').Buffer; -const Pipe = process.binding('pipe_wrap').Pipe; +const { Buffer } = require('buffer'); +const { Pipe } = process.binding('pipe_wrap'); const { errname } = process.binding('uv'); const child_process = require('internal/child_process'); +const { + _validateStdio, + setupChannel, + ChildProcess +} = child_process; -const _validateStdio = child_process._validateStdio; -const setupChannel = child_process.setupChannel; -const ChildProcess = exports.ChildProcess = child_process.ChildProcess; +exports.ChildProcess = ChildProcess; function stdioStringToArray(option) { switch (option) { -- cgit v1.2.1