diff --git a/src/node.js b/src/node.js index cecc240e426..02fccaca3dc 100644 --- a/src/node.js +++ b/src/node.js @@ -80,8 +80,7 @@ var module = new Module('eval'); module.filename = path.join(cwd, 'eval'); module.paths = Module._nodeModulePaths(cwd); - var rv = module._compile('return eval(process._eval)', 'eval'); - console.log(rv); + module._compile('eval(process._eval)', 'eval'); } else if (process.argv[1]) { // make process.argv[1] into a full path diff --git a/test/simple/test-cli-eval.js b/test/simple/test-cli-eval.js index 3340d013843..6590442aadb 100644 --- a/test/simple/test-cli-eval.js +++ b/test/simple/test-cli-eval.js @@ -30,10 +30,16 @@ if (module.parent) { process.exit(42); } -// assert that the result of the final expression is written to stdout -child.exec(nodejs + ' --eval "1337; 42"', +// assert that nothing is written to stdout +child.exec(nodejs + ' --eval 42', function(err, stdout, stderr) { - assert.equal(parseInt(stdout), 42); + assert.equal(stdout, ''); + }); + +// assert that nothing is written to stdout +child.exec(nodejs + ' --eval console.log(42)', + function(err, stdout, stderr) { + assert.equal(stdout, ''); }); // assert that module loading works @@ -50,6 +56,6 @@ child.exec(nodejs + ' --eval "require(\'./test/simple/test-cli-eval.js\')"', // empty program should do nothing child.exec(nodejs + ' -e ""', function(status, stdout, stderr) { - assert.equal(stdout, 'undefined\n'); + assert.equal(stdout, ''); assert.equal(stderr, ''); }); diff --git a/test/simple/test-eval.js b/test/simple/test-eval.js index c80ad8d2a45..c3db977fa09 100644 --- a/test/simple/test-eval.js +++ b/test/simple/test-eval.js @@ -26,7 +26,7 @@ var exec = require('child_process').exec; var success_count = 0; var error_count = 0; -var cmd = [process.execPath, '-e', '"process.argv"', 'foo', 'bar'].join(' '); +var cmd = [process.execPath, '-e', '"console.error(process.argv)"', 'foo', 'bar'].join(' '); var expected = "[ '" + process.execPath + "',\n 'foo',\n 'bar' ]\n"; var child = exec(cmd, function(err, stdout, stderr) { if (err) { @@ -34,7 +34,7 @@ var child = exec(cmd, function(err, stdout, stderr) { ++error_count; return; } - assert.equal(stdout, expected); + assert.equal(stderr, expected); ++success_count; });