Skip to content

Commit 3f41fcb

Browse files
committed
Revert "net: remove usage of require('util')"
This reverts commit e112fb4. This commit broke parallel/test-net-access-byteswritten. PR-URL: #26896 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 85fda7e commit 3f41fcb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/net.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323

2424
const EventEmitter = require('events');
2525
const stream = require('stream');
26-
const { inspect } = require('internal/util/inspect');
27-
const { debuglog } = require('internal/util/debuglog');
26+
const util = require('util');
2827
const internalUtil = require('internal/util');
2928
const {
3029
isIP,
@@ -131,7 +130,7 @@ function getNewAsyncId(handle) {
131130
}
132131

133132

134-
const debug = debuglog('net');
133+
const debug = util.debuglog('net');
135134

136135
function isPipeName(s) {
137136
return typeof s === 'string' && toNumber(s) === false;
@@ -336,8 +335,7 @@ function Socket(options) {
336335
this[kBytesRead] = 0;
337336
this[kBytesWritten] = 0;
338337
}
339-
Object.setPrototypeOf(Socket.prototype, stream.Duplex.prototype);
340-
Object.setPrototypeOf(Socket, stream.Duplex);
338+
util.inherits(Socket, stream.Duplex);
341339

342340
// Refresh existing timeouts.
343341
Socket.prototype._unrefTimer = function _unrefTimer() {
@@ -1414,7 +1412,7 @@ Server.prototype.listen = function(...args) {
14141412
'must have the property "port" or "path"');
14151413
}
14161414

1417-
throw new ERR_INVALID_OPT_VALUE('options', inspect(options));
1415+
throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options));
14181416
};
14191417

14201418
function lookupAndListen(self, port, address, backlog, exclusive, flags) {

0 commit comments

Comments
 (0)