{"action":"created","comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/209466725","pull_request_review_id":145485830,"id":209466725,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTQ2NjcyNQ==","diff_hunk":"@@ -18,6 +18,28 @@ class IO::FileDescriptor < IO\n     end\n   end\n \n+  # :nodoc:\n+  def self.from_stdio(fd)\n+    # XXX: This is -supposed- to work, but something (libevent?) is changing the FD before here.","path":"src/io/file_descriptor.cr","position":6,"original_position":6,"commit_id":"bc93f16f9bc179883ff292e40e94dc4ccefd29fd","original_commit_id":"bc93f16f9bc179883ff292e40e94dc4ccefd29fd","user":{"login":"RX14","id":2788811,"node_id":"MDQ6VXNlcjI3ODg4MTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2788811?v=4","gravatar_id":"","url":"https://api.github.com/users/RX14","html_url":"https://github.com/RX14","followers_url":"https://api.github.com/users/RX14/followers","following_url":"https://api.github.com/users/RX14/following{/other_user}","gists_url":"https://api.github.com/users/RX14/gists{/gist_id}","starred_url":"https://api.github.com/users/RX14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RX14/subscriptions","organizations_url":"https://api.github.com/users/RX14/orgs","repos_url":"https://api.github.com/users/RX14/repos","events_url":"https://api.github.com/users/RX14/events{/privacy}","received_events_url":"https://api.github.com/users/RX14/received_events","type":"User","site_admin":false},"body":"Is this comment still relevant? Is this PR still WIP?","created_at":"2018-08-12T20:25:26Z","updated_at":"2018-08-12T20:25:26Z","html_url":"https://github.com/crystal-lang/crystal/pull/6518#discussion_r209466725","pull_request_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/209466725"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/6518#discussion_r209466725"},"pull_request":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518"}}},"pull_request":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518","id":207621822,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3NjIxODIy","html_url":"https://github.com/crystal-lang/crystal/pull/6518","diff_url":"https://github.com/crystal-lang/crystal/pull/6518.diff","patch_url":"https://github.com/crystal-lang/crystal/pull/6518.patch","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6518","number":6518,"state":"open","locked":false,"title":"Reopen standard handles when they are a TTY","user":{"login":"Timbus","id":43602,"node_id":"MDQ6VXNlcjQzNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/43602?v=4","gravatar_id":"","url":"https://api.github.com/users/Timbus","html_url":"https://github.com/Timbus","followers_url":"https://api.github.com/users/Timbus/followers","following_url":"https://api.github.com/users/Timbus/following{/other_user}","gists_url":"https://api.github.com/users/Timbus/gists{/gist_id}","starred_url":"https://api.github.com/users/Timbus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Timbus/subscriptions","organizations_url":"https://api.github.com/users/Timbus/orgs","repos_url":"https://api.github.com/users/Timbus/repos","events_url":"https://api.github.com/users/Timbus/events{/privacy}","received_events_url":"https://api.github.com/users/Timbus/received_events","type":"User","site_admin":false},"body":"Reopening the TTY prevents crystal from breaking other programs that are\r\nattached to the same TTY when it sets O_NONBLOCK on its std filehandles,\r\nand also prevents crystal from breaking itself when spawning a new process.\r\n\r\nTwo important things: \r\n1. This changes the std handle numbers. Anyone expecting their programs STDIN/OUT/ERR to be 0,1, and 2, will be (sorta) wrong. This shouldn't actually affect anyone? But if it does, we can save the original FDs and swap em around.\r\n2. There are two places where I am not dealing with potential error codes and would like to know how I'm supposed to handle that, especially if the output might not be available?\r\n\r\nTo test, I put these two files in the build directory, and ran tester.sh with bash\r\n\r\n`tester.sh`\r\n```bash\r\n#!/usr/bin/env bash\r\n\r\n./.build/crystal test.cr\r\n\r\nread -p \"Prompt: \" result\r\nprintf '%s\\n' \"$result\"\r\n```\r\n\r\n`test.cr`\r\n```crystal\r\nstate = STDOUT.blocking\r\nputs \"Do we block now? #{state}\"\r\n\r\nsystem(\"echo call a subprocess\")\r\n\r\nif STDOUT.blocking == state\r\n  puts \"We cleanly spawned =)\"\r\nelse\r\n  puts \"ERRAR! Child messed with handles\"\r\nend\r\n```\r\n\r\nThis checks that the child process doesn't mess with the handle, and also ensures crystal doesn't mess with the TTY's stdin.","created_at":"2018-08-10T14:02:40Z","updated_at":"2018-08-12T20:25:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b67f38e4ba0f2d2b95040997d990cc805f02c6d4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518/commits","review_comments_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518/comments","review_comment_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6518/comments","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/bc93f16f9bc179883ff292e40e94dc4ccefd29fd","head":{"label":"Timbus:fix-ttyio","ref":"fix-ttyio","sha":"bc93f16f9bc179883ff292e40e94dc4ccefd29fd","user":{"login":"Timbus","id":43602,"node_id":"MDQ6VXNlcjQzNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/43602?v=4","gravatar_id":"","url":"https://api.github.com/users/Timbus","html_url":"https://github.com/Timbus","followers_url":"https://api.github.com/users/Timbus/followers","following_url":"https://api.github.com/users/Timbus/following{/other_user}","gists_url":"https://api.github.com/users/Timbus/gists{/gist_id}","starred_url":"https://api.github.com/users/Timbus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Timbus/subscriptions","organizations_url":"https://api.github.com/users/Timbus/orgs","repos_url":"https://api.github.com/users/Timbus/repos","events_url":"https://api.github.com/users/Timbus/events{/privacy}","received_events_url":"https://api.github.com/users/Timbus/received_events","type":"User","site_admin":false},"repo":{"id":133026624,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMwMjY2MjQ=","name":"crystal","full_name":"Timbus/crystal","owner":{"login":"Timbus","id":43602,"node_id":"MDQ6VXNlcjQzNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/43602?v=4","gravatar_id":"","url":"https://api.github.com/users/Timbus","html_url":"https://github.com/Timbus","followers_url":"https://api.github.com/users/Timbus/followers","following_url":"https://api.github.com/users/Timbus/following{/other_user}","gists_url":"https://api.github.com/users/Timbus/gists{/gist_id}","starred_url":"https://api.github.com/users/Timbus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Timbus/subscriptions","organizations_url":"https://api.github.com/users/Timbus/orgs","repos_url":"https://api.github.com/users/Timbus/repos","events_url":"https://api.github.com/users/Timbus/events{/privacy}","received_events_url":"https://api.github.com/users/Timbus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Timbus/crystal","description":"The Crystal Programming Language","fork":true,"url":"https://api.github.com/repos/Timbus/crystal","forks_url":"https://api.github.com/repos/Timbus/crystal/forks","keys_url":"https://api.github.com/repos/Timbus/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Timbus/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Timbus/crystal/teams","hooks_url":"https://api.github.com/repos/Timbus/crystal/hooks","issue_events_url":"https://api.github.com/repos/Timbus/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/Timbus/crystal/events","assignees_url":"https://api.github.com/repos/Timbus/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/Timbus/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/Timbus/crystal/tags","blobs_url":"https://api.github.com/repos/Timbus/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Timbus/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Timbus/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/Timbus/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Timbus/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/Timbus/crystal/languages","stargazers_url":"https://api.github.com/repos/Timbus/crystal/stargazers","contributors_url":"https://api.github.com/repos/Timbus/crystal/contributors","subscribers_url":"https://api.github.com/repos/Timbus/crystal/subscribers","subscription_url":"https://api.github.com/repos/Timbus/crystal/subscription","commits_url":"https://api.github.com/repos/Timbus/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/Timbus/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/Timbus/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/Timbus/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/Timbus/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/Timbus/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Timbus/crystal/merges","archive_url":"https://api.github.com/repos/Timbus/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Timbus/crystal/downloads","issues_url":"https://api.github.com/repos/Timbus/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/Timbus/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/Timbus/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/Timbus/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Timbus/crystal/labels{/name}","releases_url":"https://api.github.com/repos/Timbus/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/Timbus/crystal/deployments","created_at":"2018-05-11T10:36:18Z","updated_at":"2018-05-11T10:36:23Z","pushed_at":"2018-08-11T10:33:26Z","git_url":"git://github.com/Timbus/crystal.git","ssh_url":"git@github.com:Timbus/crystal.git","clone_url":"https://github.com/Timbus/crystal.git","svn_url":"https://github.com/Timbus/crystal","homepage":"https://crystal-lang.org","size":37827,"stargazers_count":0,"watchers_count":0,"language":"Crystal","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":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"crystal-lang:master","ref":"master","sha":"eeb53c50628fa954900e6218266ffde96435a41c","user":{"login":"crystal-lang","id":6539796,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY1Mzk3OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/6539796?v=4","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":6887813,"node_id":"MDEwOlJlcG9zaXRvcnk2ODg3ODEz","name":"crystal","full_name":"crystal-lang/crystal","owner":{"login":"crystal-lang","id":6539796,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY1Mzk3OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/6539796?v=4","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crystal-lang/crystal","description":"The Crystal Programming Language","fork":false,"url":"https://api.github.com/repos/crystal-lang/crystal","forks_url":"https://api.github.com/repos/crystal-lang/crystal/forks","keys_url":"https://api.github.com/repos/crystal-lang/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crystal-lang/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crystal-lang/crystal/teams","hooks_url":"https://api.github.com/repos/crystal-lang/crystal/hooks","issue_events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/crystal-lang/crystal/events","assignees_url":"https://api.github.com/repos/crystal-lang/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/crystal-lang/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/crystal-lang/crystal/tags","blobs_url":"https://api.github.com/repos/crystal-lang/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crystal-lang/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crystal-lang/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/crystal-lang/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/crystal-lang/crystal/languages","stargazers_url":"https://api.github.com/repos/crystal-lang/crystal/stargazers","contributors_url":"https://api.github.com/repos/crystal-lang/crystal/contributors","subscribers_url":"https://api.github.com/repos/crystal-lang/crystal/subscribers","subscription_url":"https://api.github.com/repos/crystal-lang/crystal/subscription","commits_url":"https://api.github.com/repos/crystal-lang/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/crystal-lang/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/crystal-lang/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/crystal-lang/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crystal-lang/crystal/merges","archive_url":"https://api.github.com/repos/crystal-lang/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crystal-lang/crystal/downloads","issues_url":"https://api.github.com/repos/crystal-lang/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/crystal-lang/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/crystal-lang/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/crystal-lang/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crystal-lang/crystal/labels{/name}","releases_url":"https://api.github.com/repos/crystal-lang/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/crystal-lang/crystal/deployments","created_at":"2012-11-27T17:32:32Z","updated_at":"2018-08-12T19:30:04Z","pushed_at":"2018-08-12T19:29:39Z","git_url":"git://github.com/crystal-lang/crystal.git","ssh_url":"git@github.com:crystal-lang/crystal.git","clone_url":"https://github.com/crystal-lang/crystal.git","svn_url":"https://github.com/crystal-lang/crystal","homepage":"https://crystal-lang.org","size":37844,"stargazers_count":11576,"watchers_count":11576,"language":"Crystal","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":908,"mirror_url":null,"archived":false,"open_issues_count":686,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":908,"open_issues":686,"watchers":11576,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/6518"},"issue":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/6518"},"comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/6518/comments"},"review_comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518/comments"},"review_comment":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/6518/commits"},"statuses":{"href":"https://api.github.com/repos/crystal-lang/crystal/statuses/bc93f16f9bc179883ff292e40e94dc4ccefd29fd"}},"author_association":"NONE"}}
{"actor":{"display_login":"RX14"}}