◐ Shell
clean mode source ↗

bootstrap: print `--help` message using `console.log` · nodejs/node@a52de8c

Original file line numberDiff line numberDiff line change

@@ -202,6 +202,7 @@ function format(

202202
203203

function print(stream) {

204204

const { options, aliases } = getCLIOptionsInfo();

205+

const console = require('internal/console/global');

205206
206207

// Use 75 % of the available width, and at least 70 characters.

207208

const width = MathMax(70, (stream.columns || 0) * 0.75);

@@ -212,21 +213,22 @@ function print(stream) {

212213

'(default if no file name is provided, ' +

213214

'interactive mode if a tty)' });

214215

options.set('--', { helpText: 'indicate the end of node options' });

215-

stream.write(

216+

let helpText = (

216217

'Usage: node [options] [ script.js ] [arguments]\n' +

217218

' node inspect [options] [ script.js | host:port ] [arguments]\n\n' +

218219

'Options:\n');

219-

stream.write(indent(format({

220+

helpText += (indent(format({

220221

options, aliases, firstColumn, secondColumn,

221222

}), 2));

222223
223-

stream.write('\nEnvironment variables:\n');

224+

helpText += ('\nEnvironment variables:\n');

224225
225-

stream.write(format({

226+

helpText += (format({

226227

options: envVars, firstColumn, secondColumn,

227228

}));

228229
229-

stream.write('\nDocumentation can be found at https://nodejs.org/\n');

230+

helpText += ('\nDocumentation can be found at https://nodejs.org/');

231+

console.log(helpText);

230232

}

231233
232234

prepareMainThreadExecution();