{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/13209","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/13209/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/13209/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/13209/events","html_url":"https://github.com/nodejs/node/issues/13209","id":231193784,"number":13209,"title":"repl: allow `await` in REPL","user":{"login":"benjamingr","id":1315533,"avatar_url":"https://avatars1.githubusercontent.com/u/1315533?v=3","gravatar_id":"","url":"https://api.github.com/users/benjamingr","html_url":"https://github.com/benjamingr","followers_url":"https://api.github.com/users/benjamingr/followers","following_url":"https://api.github.com/users/benjamingr/following{/other_user}","gists_url":"https://api.github.com/users/benjamingr/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamingr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamingr/subscriptions","organizations_url":"https://api.github.com/users/benjamingr/orgs","repos_url":"https://api.github.com/users/benjamingr/repos","events_url":"https://api.github.com/users/benjamingr/events{/privacy}","received_events_url":"https://api.github.com/users/benjamingr/received_events","type":"User","site_admin":false},"labels":[{"id":523004170,"url":"https://api.github.com/repos/nodejs/node/labels/cli","name":"cli","color":"bfd4f2","default":false},{"id":207445406,"url":"https://api.github.com/repos/nodejs/node/labels/feature%20request","name":"feature request","color":"0D7BDE","default":false},{"id":340436277,"url":"https://api.github.com/repos/nodejs/node/labels/promises","name":"promises","color":"f7c6c7","default":false},{"id":155435882,"url":"https://api.github.com/repos/nodejs/node/labels/repl","name":"repl","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2017-05-24T22:52:26Z","updated_at":"2017-05-30T13:20:19Z","closed_at":null,"body":"I've seen this [requested](https://stackoverflow.com/questions/44169542/how-to-resolve-promises-when-using-app-with-repl/) a few times in StackOverflow now: \r\n\r\nPeople have code that is asynchronous and would like to use values from it in the REPL:\r\n\r\n    // how do I access in the REPL? returns promise\r\n    Transaction.where('reference', '1').fetch().then((res) => { return res }); \r\n\r\nA common workaround is to store a global reference in the REPL, which is a little hacky and relies on timing, but can work for simple cases:\r\n\r\n    > Transaction.where('reference', '1').fetch().then((res) => out = res)\r\n    [Object Promise]\r\n    > out\r\n       /* response available here*/\r\n\r\nThis works, but has timing issues and generally isn't great. We could however run the REPL in the context of an async function potentially - which would allow `await`ing values in the REPL:\r\n\r\n    let res = await Transaction.where('reference', '1').fetch(); \r\n\r\nI think it could be an interesting enhancement but would like more feedback on the idea. @nodejs/collaborators "},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/304875746","html_url":"https://github.com/nodejs/node/issues/13209#issuecomment-304875746","issue_url":"https://api.github.com/repos/nodejs/node/issues/13209","id":304875746,"user":{"login":"bmeck","id":234659,"avatar_url":"https://avatars2.githubusercontent.com/u/234659?v=3","gravatar_id":"","url":"https://api.github.com/users/bmeck","html_url":"https://github.com/bmeck","followers_url":"https://api.github.com/users/bmeck/followers","following_url":"https://api.github.com/users/bmeck/following{/other_user}","gists_url":"https://api.github.com/users/bmeck/gists{/gist_id}","starred_url":"https://api.github.com/users/bmeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmeck/subscriptions","organizations_url":"https://api.github.com/users/bmeck/orgs","repos_url":"https://api.github.com/users/bmeck/repos","events_url":"https://api.github.com/users/bmeck/events{/privacy}","received_events_url":"https://api.github.com/users/bmeck/received_events","type":"User","site_admin":false},"created_at":"2017-05-30T13:20:19Z","updated_at":"2017-05-30T13:20:19Z","body":"at some point people might want to think of foreground and backgrounding await if you need to test how 2 async things interact... like Jobs in shells"}}
{"actor":{"display_login":"bmeck"}}