Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
process: set _print_eval even when --eval is not passed
Browse files Browse the repository at this point in the history
This is for scripts being fed from stdin:

  $ echo "{ foo: 'bar' }" | node -p
  • Loading branch information
TooTallNate committed Apr 24, 2012
1 parent 0b5235e commit ef3a874
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/node.cc
Expand Up @@ -2209,7 +2209,11 @@ Handle<Object> 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) {
Expand Down

0 comments on commit ef3a874

Please sign in to comment.