{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/4955","labels_url":"https://api.github.com/repos/nodejs/node/issues/4955/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/4955/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/4955/events","html_url":"https://github.com/nodejs/node/pull/4955","id":129840883,"number":4955,"title":"vm: adds runInModuleContext()","user":{"login":"eljefedelrodeodeljefe","id":3899684,"avatar_url":"https://avatars.githubusercontent.com/u/3899684?v=3","gravatar_id":"","url":"https://api.github.com/users/eljefedelrodeodeljefe","html_url":"https://github.com/eljefedelrodeodeljefe","followers_url":"https://api.github.com/users/eljefedelrodeodeljefe/followers","following_url":"https://api.github.com/users/eljefedelrodeodeljefe/following{/other_user}","gists_url":"https://api.github.com/users/eljefedelrodeodeljefe/gists{/gist_id}","starred_url":"https://api.github.com/users/eljefedelrodeodeljefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eljefedelrodeodeljefe/subscriptions","organizations_url":"https://api.github.com/users/eljefedelrodeodeljefe/orgs","repos_url":"https://api.github.com/users/eljefedelrodeodeljefe/repos","events_url":"https://api.github.com/users/eljefedelrodeodeljefe/events{/privacy}","received_events_url":"https://api.github.com/users/eljefedelrodeodeljefe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/vm","name":"vm","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2016-01-29T18:05:13Z","updated_at":"2016-01-30T19:05:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/4955","html_url":"https://github.com/nodejs/node/pull/4955","diff_url":"https://github.com/nodejs/node/pull/4955.diff","patch_url":"https://github.com/nodejs/node/pull/4955.patch"},"body":"With regards to nodejs/node-v0.x-archive#9211, [this SO question](http://stackoverflow.com/questions/20899863/the-module-property-is-undefined-when-using-vm-runinthiscontext) and in order to prevent a signature like the below, I want to propose `vm.runInGlobalContext()`. This would make the `vm` API more clear to users, who expect at least one method `vm` that behaves exactly like their global context.\r\n\r\n```js\r\nconst vmResult = vm.runInThisContext(require('module').wrap(`\r\n   const http = require('http');\r\n   http.createServer( (request, response) => {\r\n     response.writeHead(200, {'Content-Type': 'text/plain'});\r\n     response.end('Hello World\\\\n');\r\n   }).listen(8124);\r\n\r\n   console.log('Server running at http://127.0.0.1:8124/');\r\n`))(exports, require, module, __filename, __dirname)\r\n```"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/177278144","html_url":"https://github.com/nodejs/node/pull/4955#issuecomment-177278144","issue_url":"https://api.github.com/repos/nodejs/node/issues/4955","id":177278144,"user":{"login":"vkurchatkin","id":2993861,"avatar_url":"https://avatars.githubusercontent.com/u/2993861?v=3","gravatar_id":"","url":"https://api.github.com/users/vkurchatkin","html_url":"https://github.com/vkurchatkin","followers_url":"https://api.github.com/users/vkurchatkin/followers","following_url":"https://api.github.com/users/vkurchatkin/following{/other_user}","gists_url":"https://api.github.com/users/vkurchatkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurchatkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurchatkin/subscriptions","organizations_url":"https://api.github.com/users/vkurchatkin/orgs","repos_url":"https://api.github.com/users/vkurchatkin/repos","events_url":"https://api.github.com/users/vkurchatkin/events{/privacy}","received_events_url":"https://api.github.com/users/vkurchatkin/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T19:05:51Z","updated_at":"2016-01-30T19:05:51Z","body":"> Yes and that's fine for me\r\n\r\nThat's not a very good reason yo include this in core.\r\n\r\n> Security in my use case wouldn't be necessary, since trusting code wouldn't be of concern here.\r\n\r\nSo, `eval` is fine then"}}