Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58de6ce

Browse filesBrowse files
VoltrexKeyvaBethGriggs
authored andcommitted
process: refactor execution
• Removed unreachable code of the `evalModule()` function as an early error is thrown when the `print` parameter is a truthy value. • Make use of the nullish coalescing operator. PR-URL: #40664 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
1 parent 1c8590e commit 58de6ce
Copy full SHA for 58de6ce

File tree

Expand file treeCollapse file tree

1 file changed

+2
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-8
lines changed
Open diff view settings
Collapse file

‎lib/internal/process/execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/execution.js
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,9 @@ function evalModule(source, print) {
4242
if (print) {
4343
throw new ERR_EVAL_ESM_CANNOT_PRINT();
4444
}
45-
const { log } = require('internal/console/global');
4645
const { loadESM } = require('internal/process/esm_loader');
4746
const { handleMainPromise } = require('internal/modules/run_main');
48-
return handleMainPromise(loadESM(async (loader) => {
49-
const { result } = await loader.eval(source);
50-
if (print) {
51-
log(result);
52-
}
53-
}));
47+
return handleMainPromise(loadESM((loader) => loader.eval(source)));
5448
}
5549

5650
function evalScript(name, body, breakFirstLine, print) {
@@ -158,7 +152,7 @@ function createOnGlobalUncaughtException() {
158152
'Exception',
159153
'Exception',
160154
null,
161-
er ? er : {});
155+
er ?? {});
162156
}
163157
} catch {} // Ignore the exception. Diagnostic reporting is unavailable.
164158
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.