{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/176844727","pull_request_review_id":106623991,"id":176844727,"diff_hunk":"@@ -23,7 +23,58 @@ defmodule StringIO do\n \n   If the `:capture_prompt` option is set to `true`,\n   prompts (specified as arguments to `IO.get*` functions)\n-  are captured.\n+  are captured in the output.\n+\n+  The device will be created and sent to the function given.\n+  When the function returns, the device will be closed. The final\n+  result will be a tuple with `:ok` and the result of the function.\n+\n+  ## Examples\n+\n+    iex> {:ok, _contents} = StringIO.open(\"foo\", [], fn(pid) ->\n+    ...>    input = IO.gets(pid, \">\")\n+    ...>    IO.write(pid, \"The input was \\#{input}\")","path":"lib/elixir/lib/string_io.ex","position":15,"original_position":15,"commit_id":"f0f6ae66ed57cdb9db05690c6c729aab77f38299","original_commit_id":"f0f6ae66ed57cdb9db05690c6c729aab77f38299","user":{"login":"whatyouhide","id":3890250,"avatar_url":"https://avatars3.githubusercontent.com/u/3890250?v=4","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"body":"You can use `~S\"\"\"` to avoid having to escape things.","created_at":"2018-03-23T19:39:48Z","updated_at":"2018-03-23T19:40:28Z","html_url":"https://github.com/elixir-lang/elixir/pull/7477#discussion_r176844727","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/176844727"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/7477#discussion_r176844727"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477"}}},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477","id":176893605,"html_url":"https://github.com/elixir-lang/elixir/pull/7477","diff_url":"https://github.com/elixir-lang/elixir/pull/7477.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/7477.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/7477","number":7477,"state":"open","locked":false,"title":"Pass a function StringIO.open to allow the device to be closed automatically","user":{"login":"easco","id":8010,"avatar_url":"https://avatars1.githubusercontent.com/u/8010?v=4","gravatar_id":"","url":"https://api.github.com/users/easco","html_url":"https://github.com/easco","followers_url":"https://api.github.com/users/easco/followers","following_url":"https://api.github.com/users/easco/following{/other_user}","gists_url":"https://api.github.com/users/easco/gists{/gist_id}","starred_url":"https://api.github.com/users/easco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easco/subscriptions","organizations_url":"https://api.github.com/users/easco/orgs","repos_url":"https://api.github.com/users/easco/repos","events_url":"https://api.github.com/users/easco/events{/privacy}","received_events_url":"https://api.github.com/users/easco/received_events","type":"User","site_admin":false},"body":"Similar to the way you can pass a function to `File.open` this change allows you to pass a function to `StringIO.open`.  The function will receive the `StringIO` device as a parameter and when the function completes the device will be closed automatically.  The function may be passed in lieu of options to `StringIO.open/2` and a new `StringIO.open/3` function is available should you wish to pass both options and a function.\r\n\r\nExamples are included in doc tests.\r\n\r\nPlease offer feedback or suggestions.  Reviewers should pay particular attention to `@spec` declarations as they are an area of weakness for me.","created_at":"2018-03-22T20:01:02Z","updated_at":"2018-03-23T19:40:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfcf806a9fea25648997d333371c91261f515c30","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/7477/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/f0f6ae66ed57cdb9db05690c6c729aab77f38299","head":{"label":"easco:master","ref":"master","sha":"f0f6ae66ed57cdb9db05690c6c729aab77f38299","user":{"login":"easco","id":8010,"avatar_url":"https://avatars1.githubusercontent.com/u/8010?v=4","gravatar_id":"","url":"https://api.github.com/users/easco","html_url":"https://github.com/easco","followers_url":"https://api.github.com/users/easco/followers","following_url":"https://api.github.com/users/easco/following{/other_user}","gists_url":"https://api.github.com/users/easco/gists{/gist_id}","starred_url":"https://api.github.com/users/easco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easco/subscriptions","organizations_url":"https://api.github.com/users/easco/orgs","repos_url":"https://api.github.com/users/easco/repos","events_url":"https://api.github.com/users/easco/events{/privacy}","received_events_url":"https://api.github.com/users/easco/received_events","type":"User","site_admin":false},"repo":{"id":126386698,"name":"elixir","full_name":"easco/elixir","owner":{"login":"easco","id":8010,"avatar_url":"https://avatars1.githubusercontent.com/u/8010?v=4","gravatar_id":"","url":"https://api.github.com/users/easco","html_url":"https://github.com/easco","followers_url":"https://api.github.com/users/easco/followers","following_url":"https://api.github.com/users/easco/following{/other_user}","gists_url":"https://api.github.com/users/easco/gists{/gist_id}","starred_url":"https://api.github.com/users/easco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easco/subscriptions","organizations_url":"https://api.github.com/users/easco/orgs","repos_url":"https://api.github.com/users/easco/repos","events_url":"https://api.github.com/users/easco/events{/privacy}","received_events_url":"https://api.github.com/users/easco/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/easco/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":true,"url":"https://api.github.com/repos/easco/elixir","forks_url":"https://api.github.com/repos/easco/elixir/forks","keys_url":"https://api.github.com/repos/easco/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/easco/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/easco/elixir/teams","hooks_url":"https://api.github.com/repos/easco/elixir/hooks","issue_events_url":"https://api.github.com/repos/easco/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/easco/elixir/events","assignees_url":"https://api.github.com/repos/easco/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/easco/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/easco/elixir/tags","blobs_url":"https://api.github.com/repos/easco/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/easco/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/easco/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/easco/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/easco/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/easco/elixir/languages","stargazers_url":"https://api.github.com/repos/easco/elixir/stargazers","contributors_url":"https://api.github.com/repos/easco/elixir/contributors","subscribers_url":"https://api.github.com/repos/easco/elixir/subscribers","subscription_url":"https://api.github.com/repos/easco/elixir/subscription","commits_url":"https://api.github.com/repos/easco/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/easco/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/easco/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/easco/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/easco/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/easco/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/easco/elixir/merges","archive_url":"https://api.github.com/repos/easco/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/easco/elixir/downloads","issues_url":"https://api.github.com/repos/easco/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/easco/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/easco/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/easco/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/easco/elixir/labels{/name}","releases_url":"https://api.github.com/repos/easco/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/easco/elixir/deployments","created_at":"2018-03-22T19:41:47Z","updated_at":"2018-03-23T14:39:15Z","pushed_at":"2018-03-23T14:39:10Z","git_url":"git://github.com/easco/elixir.git","ssh_url":"git@github.com:easco/elixir.git","clone_url":"https://github.com/easco/elixir.git","svn_url":"https://github.com/easco/elixir","homepage":"http://elixir-lang.org/","size":35928,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elixir-lang:master","ref":"master","sha":"5947ed751eb0276cb7fda666c319dba451a5e9e7","user":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2018-03-23T15:54:01Z","pushed_at":"2018-03-23T18:57:14Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":35918,"stargazers_count":12574,"watchers_count":12574,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1832,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1832,"open_issues":34,"watchers":12574,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/7477"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/7477"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/7477/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/7477/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/f0f6ae66ed57cdb9db05690c6c729aab77f38299"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"whatyouhide"}}