From e0c10f63b05323dfbaec31397158ae9fe355b733 Mon Sep 17 00:00:00 2001 From: Adri Van Houdt Date: Sat, 17 Sep 2016 12:35:41 +0200 Subject: [PATCH] process: changed var to const in internal/process.js PR-URL: https://github.com/nodejs/node/pull/8614 Refs: https://github.com/nodejs/code-and-learn/issues/56 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Ilkka Myller --- lib/internal/process.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/internal/process.js b/lib/internal/process.js index 61efa954b64447..8afb89dccac84b 100644 --- a/lib/internal/process.js +++ b/lib/internal/process.js @@ -168,7 +168,7 @@ function setupKillAndExit() { } if (err) { - var errnoException = require('util')._errnoException; + const errnoException = require('util')._errnoException; throw errnoException(err, 'kill'); } @@ -180,7 +180,7 @@ function setupKillAndExit() { function setupSignalHandlers() { // Load events module in order to access prototype elements on process like // process.addListener. - var signalWraps = {}; + const signalWraps = {}; function isSignal(event) { return typeof event === 'string' && @@ -191,18 +191,18 @@ function setupSignalHandlers() { process.on('newListener', function(type, listener) { if (isSignal(type) && !signalWraps.hasOwnProperty(type)) { - var Signal = process.binding('signal_wrap').Signal; - var wrap = new Signal(); + const Signal = process.binding('signal_wrap').Signal; + const wrap = new Signal(); wrap.unref(); wrap.onsignal = function() { process.emit(type); }; - var signum = lazyConstants()[type]; - var err = wrap.start(signum); + const signum = lazyConstants()[type]; + const err = wrap.start(signum); if (err) { wrap.close(); - var errnoException = require('util')._errnoException; + const errnoException = require('util')._errnoException; throw errnoException(err, 'uv_signal_start'); } @@ -223,13 +223,13 @@ function setupChannel() { // If we were spawned with env NODE_CHANNEL_FD then load that up and // start parsing data from that stream. if (process.env.NODE_CHANNEL_FD) { - var fd = parseInt(process.env.NODE_CHANNEL_FD, 10); + const fd = parseInt(process.env.NODE_CHANNEL_FD, 10); assert(fd >= 0); // Make sure it's not accidentally inherited by child processes. delete process.env.NODE_CHANNEL_FD; - var cp = require('child_process'); + const cp = require('child_process'); // Load tcp_wrap to avoid situation where we might immediately receive // a message. @@ -243,8 +243,8 @@ function setupChannel() { function setupRawDebug() { - var format = require('util').format; - var rawDebug = process._rawDebug; + const format = require('util').format; + const rawDebug = process._rawDebug; process._rawDebug = function() { rawDebug(format.apply(null, arguments)); };