|
26 | 26 |
|
27 | 27 | setupProcessObject(); |
28 | 28 |
|
29 | | -// do this good and early, since it handles errors. |
| 29 | +// Do this good and early, since it handles errors. |
30 | 30 | setupProcessFatal(); |
31 | 31 |
|
32 | 32 | setupV8(); |
|
107 | 107 | }); |
108 | 108 | process.argv[0]=process.execPath; |
109 | 109 |
|
110 | | -// Handle `--debug*` deprecation and invalidation |
| 110 | +// Handle `--debug*` deprecation and invalidation. |
111 | 111 | if(process._invalidDebug){ |
112 | 112 | process.emitWarning( |
113 | 113 | '`node --debug` and `node --debug-brk` are invalid. '+ |
|
176 | 176 | 'DeprecationWarning','DEP0068'); |
177 | 177 | } |
178 | 178 |
|
179 | | -// Start the debugger agent |
| 179 | +// Start the debugger agent. |
180 | 180 | process.nextTick(function(){ |
181 | 181 | NativeModule.require('internal/deps/node-inspect/lib/_inspect').start(); |
182 | 182 | }); |
|
185 | 185 | NativeModule.require('internal/v8_prof_processor'); |
186 | 186 |
|
187 | 187 | }else{ |
188 | | -// There is user code to be run |
| 188 | +// There is user code to be run. |
189 | 189 |
|
190 | 190 | // If this is a worker in cluster mode, start up the communication |
191 | 191 | // channel. This needs to be done before any user code gets executed |
|
203 | 203 | perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START); |
204 | 204 | perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_END); |
205 | 205 | // User passed '-e' or '--eval' arguments to Node without '-i' or |
206 | | -// '--interactive' |
| 206 | +// '--interactive'. |
207 | 207 |
|
208 | 208 | perf.markMilestone( |
209 | 209 | NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_START); |
|
217 | 217 | evalScript('[eval]'); |
218 | 218 | }elseif(process.argv[1]&&process.argv[1]!=='-'){ |
219 | 219 | perf.markMilestone(NODE_PERFORMANCE_MILESTONE_MODULE_LOAD_START); |
220 | | -// make process.argv[1] into a full path |
| 220 | +// Make process.argv[1] into a full path. |
221 | 221 | constpath=NativeModule.require('path'); |
222 | 222 | process.argv[1]=path.resolve(process.argv[1]); |
223 | 223 |
|
|
229 | 229 | preloadModules(); |
230 | 230 | perf.markMilestone( |
231 | 231 | NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END); |
232 | | -// check if user passed `-c` or `--check` arguments to Node. |
| 232 | +// Check if user passed `-c` or `--check` arguments to Node. |
233 | 233 | if(process._syntax_check_only!=null){ |
234 | 234 | constfs=NativeModule.require('fs'); |
235 | | -// read the source |
| 235 | +// Read the source. |
236 | 236 | constfilename=CJSModule._resolveFilename(process.argv[1]); |
237 | 237 | constsource=fs.readFileSync(filename,'utf-8'); |
238 | 238 | checkScriptSyntax(source,filename); |
|
364 | 364 | functionsetupGlobalConsole(){ |
365 | 365 | constoriginalConsole=global.console; |
366 | 366 | constCJSModule=NativeModule.require('internal/modules/cjs/loader'); |
367 | | -// Setup Node.js global.console |
| 367 | +// Setup Node.js global.console. |
368 | 368 | constwrappedConsole=NativeModule.require('console'); |
369 | 369 | Object.defineProperty(global,'console',{ |
370 | 370 | configurable: true, |
|
398 | 398 | return; |
399 | 399 | } |
400 | 400 | const{ addCommandLineAPI, consoleCall }=process.binding('inspector'); |
401 | | -// Setup inspector command line API |
| 401 | +// Setup inspector command line API. |
402 | 402 | const{ makeRequireFunction }= |
403 | 403 | NativeModule.require('internal/modules/cjs/helpers'); |
404 | 404 | constpath=NativeModule.require('path'); |
|
448 | 448 | exceptionHandlerState.captureFn(er); |
449 | 449 | }elseif(!process.emit('uncaughtException',er)){ |
450 | 450 | // If someone handled it, then great. otherwise, die in C++ land |
451 | | -// since that means that we'll exit the process, emit the 'exit' event |
| 451 | +// since that means that we'll exit the process, emit the 'exit' event. |
452 | 452 | try{ |
453 | 453 | if(!process._exiting){ |
454 | 454 | process._exiting=true; |
455 | 455 | process.emit('exit',1); |
456 | 456 | } |
457 | | -}catch(er){ |
458 | | -// nothing to be done about it at this point. |
| 457 | +}catch{ |
| 458 | +// Nothing to be done about it at this point. |
459 | 459 | } |
460 | 460 | try{ |
461 | 461 | const{ kExpandStackSymbol }=NativeModule.require('internal/util'); |
|
466 | 466 | } |
467 | 467 |
|
468 | 468 | // If we handled an error, then make sure any ticks get processed |
469 | | -// by ensuring that the next Immediate cycle isn't empty |
| 469 | +// by ensuring that the next Immediate cycle isn't empty. |
470 | 470 | NativeModule.require('timers').setImmediate(noop); |
471 | 471 |
|
472 | 472 | // Emit the after() hooks now that the exception has been handled. |
|
559 | 559 | process._tickCallback(); |
560 | 560 | } |
561 | 561 |
|
562 | | -// Load preload modules |
| 562 | +// Load preload modules. |
563 | 563 | functionpreloadModules(){ |
564 | 564 | if(process._preload_modules){ |
565 | 565 | const{ |
|
576 | 576 | stripShebang, stripBOM |
577 | 577 | }=NativeModule.require('internal/modules/cjs/helpers'); |
578 | 578 |
|
579 | | -// remove Shebang |
| 579 | +// Remove Shebang. |
580 | 580 | source=stripShebang(source); |
581 | | -// remove BOM |
| 581 | +// Remove BOM. |
582 | 582 | source=stripBOM(source); |
583 | | -// wrap it |
| 583 | +// Wrap it. |
584 | 584 | source=CJSModule.wrap(source); |
585 | | -// compile the script, this will throw if it fails |
| 585 | +// Compile the script, this will throw if it fails. |
586 | 586 | newvm.Script(source,{displayErrors: true, filename }); |
587 | 587 | } |
588 | 588 |
|
|
0 commit comments