-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Closed
Labels
utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
I'm not entirely sure if this is a bug or my misunderstanding, but I was surprised to discover that these two expressions have different values in the 5.1.0 node repl:
vm.runInNewContext("util.inspect({})", { util: util }) //=> 'Object {}'
util.inspect({}) //=> '{}'
or for standalone examples outside of the repl:
bash> node -pe "require('vm').runInNewContext('util.inspect({})', { util: require('util') })"
Object {}
bash> node -pe "require('util').inspect({})"
{}
Is this intended behavior? Is there a way to get the repl equivalent result from util.inspect
in a vm
without resorting to string replacement?
Metadata
Metadata
Assignees
Labels
utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.