From ef3a874f41b617e9531909b2b6bbd6b02f1775a7 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 24 Apr 2012 01:24:13 -0700 Subject: [PATCH] process: set _print_eval even when --eval is not passed This is for scripts being fed from stdin: $ echo "{ foo: 'bar' }" | node -p --- src/node.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 7bfcdb8623c..714dd4c35f7 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2209,7 +2209,11 @@ Handle SetupProcessObject(int argc, char *argv[]) { // -e, --eval if (eval_string) { process->Set(String::NewSymbol("_eval"), String::New(eval_string)); - process->Set(String::NewSymbol("_print_eval"), Boolean::New(print_eval)); + } + + // -p, --print + if (print_eval) { + process->Set(String::NewSymbol("_print_eval"), True()); } if (force_repl) {