From e916a2ad544783532f9cb697e2cf75705a869035 Mon Sep 17 00:00:00 2001 From: dnlup Date: Tue, 19 Mar 2019 12:06:08 +0100 Subject: [PATCH] lib: remove usage of require('util') MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove usage of public require('util') in `internal/child_process`. Refs: https://github.com/nodejs/node/issues/26546 PR-URL: https://github.com/nodejs/node/pull/26773 Reviewed-By: Yongsheng Zhang Reviewed-By: Michaƫl Zasso --- lib/internal/child_process.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index d6121c70ef9943..503564df787172 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -19,6 +19,7 @@ const EventEmitter = require('events'); const net = require('net'); const dgram = require('dgram'); const util = require('util'); +const inspect = require('internal/util/inspect').inspect; const assert = require('internal/assert'); const { Process } = internalBinding('process_wrap'); @@ -887,7 +888,7 @@ function _validateStdio(stdio, sync) { throw new ERR_INVALID_OPT_VALUE('stdio', stdio); } } else if (!Array.isArray(stdio)) { - throw new ERR_INVALID_OPT_VALUE('stdio', util.inspect(stdio)); + throw new ERR_INVALID_OPT_VALUE('stdio', inspect(stdio)); } // At least 3 stdio will be created @@ -967,12 +968,12 @@ function _validateStdio(stdio, sync) { } else if (isArrayBufferView(stdio) || typeof stdio === 'string') { if (!sync) { cleanup(); - throw new ERR_INVALID_SYNC_FORK_INPUT(util.inspect(stdio)); + throw new ERR_INVALID_SYNC_FORK_INPUT(inspect(stdio)); } } else { // Cleanup cleanup(); - throw new ERR_INVALID_OPT_VALUE('stdio', util.inspect(stdio)); + throw new ERR_INVALID_OPT_VALUE('stdio', inspect(stdio)); } return acc;