Commit 5a823400b25 for nodejs

commit 5a823400b2558ccfc1e312011c2b12f1587970d8
Author: Lazizbek Ergashev <lazerg2@gmail.com>
Date:   Wed Nov 18 22:55:41 2026 +0500

    lib: end --eval crypto wrapper code with a newline

    Assisted-by: Claude Code
    Signed-off-by: lazerg <lazerg2@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67162
    Fixes: https://github.com/nodejs/node/issues/67159
    Reviewed-By: Filip Skokan <panva.ip@gmail.com>

diff --git a/lib/internal/main/eval_string.js b/lib/internal/main/eval_string.js
index c662b8c2c26..4cacb63ee9d 100644
--- a/lib/internal/main/eval_string.js
+++ b/lib/internal/main/eval_string.js
@@ -70,7 +70,7 @@ if (inputType === 'module') {

   evalFunction('[eval]',
                shouldDefineCrypto ? (
-                 print ? `let crypto=require("node:crypto");{${code}}` : `(crypto=>{{${code}}})(require('node:crypto'))`
+                 print ? `let crypto=require("node:crypto");{${code}\n}` : `(crypto=>{{${code}\n}})(require('node:crypto'))`
                ) : code,
                getOptionValue('--inspect-brk'),
                print,
diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js
index 5b090279621..660d308a8fb 100644
--- a/test/parallel/test-cli-eval.js
+++ b/test/parallel/test-cli-eval.js
@@ -329,6 +329,14 @@ if (common.hasCrypto) {
     common.mustSucceed((stdout) => {
       assert.match(stdout, /[0-9a-f]{32}/i);
     }));
+  child.execFile(process.execPath, ['-e', 'console.log(typeof crypto.randomBytes) // comment'],
+                 common.mustSucceed((stdout) => {
+                   assert.strictEqual(stdout, 'function\n');
+                 }));
+  child.execFile(process.execPath, ['-p', 'typeof crypto.randomBytes // comment'],
+                 common.mustSucceed((stdout) => {
+                   assert.strictEqual(stdout, 'function\n');
+                 }));
 }
 // Assert that overriding crypto works.
 child.exec(