{"action":"created","comment":{"url":"https://api.github.com/repos/dlang/phobos/pulls/comments/92647482","pull_request_review_id":13167110,"id":92647482,"diff_hunk":"@@ -806,6 +806,68 @@ private void setCLOEXEC(int fd, bool on) nothrow @nogc\n     assert (wait(spawnProcess([prog.path, \"foo\", \"bar\"])) == 0);\n }\n \n+version (Posix) @system unittest\n+{\n+    import core.sys.posix.fcntl : open, O_RDONLY;\n+    import core.sys.posix.unistd : close;\n+    import std.path : buildPath;\n+    import std.algorithm.searching : canFind, findSplitBefore;\n+    import std.functional : reverseArgs;\n+    import std.array : split;\n+    import std.conv : to;\n+    static import std.file;\n+\n+    auto directory = uniqueTempPath();\n+    std.file.mkdir(directory);\n+    scope(exit) std.file.rmdirRecurse(directory);\n+    auto path = buildPath(directory, \"tmp\");\n+    std.file.write(path, null);\n+    auto fd = open(path.tempCString, O_RDONLY);\n+    scope(exit) close(fd);\n+\n+    // try /proc/<pid>/fd/ on linux\n+    version (linux)\n+    {\n+        TestScript proc = \"ls /proc/$$/fd\";\n+        auto procRes = execute(proc.path, null);\n+        if (procRes.status == 0)\n+        {\n+            auto fdStr = fd.to!string;\n+            assert (!procRes.output.split.canFind(fdStr));\n+            assert (execute(proc.path, null, Config.inheritFDs)\n+                    .output.split.canFind(fdStr));\n+            return;\n+        }\n+    }\n+\n+    // try fuser (sometimes need permissions)\n+    TestScript fuser = \"echo $$ && fuser -f \" ~ path;","path":"std/process.d","position":39,"original_position":39,"commit_id":"eddc930aab4191b902bed3ebd874c393787d083b","original_commit_id":"eddc930aab4191b902bed3ebd874c393787d083b","user":{"login":"schveiguy","id":580778,"avatar_url":"https://avatars.githubusercontent.com/u/580778?v=3","gravatar_id":"","url":"https://api.github.com/users/schveiguy","html_url":"https://github.com/schveiguy","followers_url":"https://api.github.com/users/schveiguy/followers","following_url":"https://api.github.com/users/schveiguy/following{/other_user}","gists_url":"https://api.github.com/users/schveiguy/gists{/gist_id}","starred_url":"https://api.github.com/users/schveiguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schveiguy/subscriptions","organizations_url":"https://api.github.com/users/schveiguy/orgs","repos_url":"https://api.github.com/users/schveiguy/repos","events_url":"https://api.github.com/users/schveiguy/events{/privacy}","received_events_url":"https://api.github.com/users/schveiguy/received_events","type":"User","site_admin":false},"body":"echo is a shell builtin as well, and `&&` I think is also.","created_at":"2016-12-15T16:38:54Z","updated_at":"2016-12-15T16:40:39Z","html_url":"https://github.com/dlang/phobos/pull/4948#discussion_r92647482","pull_request_url":"https://api.github.com/repos/dlang/phobos/pulls/4948","_links":{"self":{"href":"https://api.github.com/repos/dlang/phobos/pulls/comments/92647482"},"html":{"href":"https://github.com/dlang/phobos/pull/4948#discussion_r92647482"},"pull_request":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4948"}}},"pull_request":{"url":"https://api.github.com/repos/dlang/phobos/pulls/4948","id":97593021,"html_url":"https://github.com/dlang/phobos/pull/4948","diff_url":"https://github.com/dlang/phobos/pull/4948.diff","patch_url":"https://github.com/dlang/phobos/pull/4948.patch","issue_url":"https://api.github.com/repos/dlang/phobos/issues/4948","number":4948,"state":"open","locked":false,"title":"test inheritFDs","user":{"login":"John-Colvin","id":1867189,"avatar_url":"https://avatars.githubusercontent.com/u/1867189?v=3","gravatar_id":"","url":"https://api.github.com/users/John-Colvin","html_url":"https://github.com/John-Colvin","followers_url":"https://api.github.com/users/John-Colvin/followers","following_url":"https://api.github.com/users/John-Colvin/following{/other_user}","gists_url":"https://api.github.com/users/John-Colvin/gists{/gist_id}","starred_url":"https://api.github.com/users/John-Colvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/John-Colvin/subscriptions","organizations_url":"https://api.github.com/users/John-Colvin/orgs","repos_url":"https://api.github.com/users/John-Colvin/repos","events_url":"https://api.github.com/users/John-Colvin/events{/privacy}","received_events_url":"https://api.github.com/users/John-Colvin/received_events","type":"User","site_admin":false},"body":"Tests that the code changed in https://github.com/dlang/phobos/pull/4934 actually does what it says it does\r\n\r\nThis isn't perfect, it turns out that testing whether a fd is open in a way that is both posix-portable and doesn't require compiling C is basically impossible. Currently I print a warning if I can't find a way of testing, but that could be a failure instead, I can't decide.\r\n\r\nI'd love to know if there's an easier way.","created_at":"2016-12-12T17:07:28Z","updated_at":"2016-12-15T16:40:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9370f583c19abca3c1ee4ad02af94a4b57bef627","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dlang/phobos/pulls/4948/commits","review_comments_url":"https://api.github.com/repos/dlang/phobos/pulls/4948/comments","review_comment_url":"https://api.github.com/repos/dlang/phobos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dlang/phobos/issues/4948/comments","statuses_url":"https://api.github.com/repos/dlang/phobos/statuses/eddc930aab4191b902bed3ebd874c393787d083b","head":{"label":"John-Colvin:test_inheritFDs","ref":"test_inheritFDs","sha":"eddc930aab4191b902bed3ebd874c393787d083b","user":{"login":"John-Colvin","id":1867189,"avatar_url":"https://avatars.githubusercontent.com/u/1867189?v=3","gravatar_id":"","url":"https://api.github.com/users/John-Colvin","html_url":"https://github.com/John-Colvin","followers_url":"https://api.github.com/users/John-Colvin/followers","following_url":"https://api.github.com/users/John-Colvin/following{/other_user}","gists_url":"https://api.github.com/users/John-Colvin/gists{/gist_id}","starred_url":"https://api.github.com/users/John-Colvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/John-Colvin/subscriptions","organizations_url":"https://api.github.com/users/John-Colvin/orgs","repos_url":"https://api.github.com/users/John-Colvin/repos","events_url":"https://api.github.com/users/John-Colvin/events{/privacy}","received_events_url":"https://api.github.com/users/John-Colvin/received_events","type":"User","site_admin":false},"repo":{"id":9150941,"name":"phobos","full_name":"John-Colvin/phobos","owner":{"login":"John-Colvin","id":1867189,"avatar_url":"https://avatars.githubusercontent.com/u/1867189?v=3","gravatar_id":"","url":"https://api.github.com/users/John-Colvin","html_url":"https://github.com/John-Colvin","followers_url":"https://api.github.com/users/John-Colvin/followers","following_url":"https://api.github.com/users/John-Colvin/following{/other_user}","gists_url":"https://api.github.com/users/John-Colvin/gists{/gist_id}","starred_url":"https://api.github.com/users/John-Colvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/John-Colvin/subscriptions","organizations_url":"https://api.github.com/users/John-Colvin/orgs","repos_url":"https://api.github.com/users/John-Colvin/repos","events_url":"https://api.github.com/users/John-Colvin/events{/privacy}","received_events_url":"https://api.github.com/users/John-Colvin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/John-Colvin/phobos","description":"The standard library of the D programming language","fork":true,"url":"https://api.github.com/repos/John-Colvin/phobos","forks_url":"https://api.github.com/repos/John-Colvin/phobos/forks","keys_url":"https://api.github.com/repos/John-Colvin/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/John-Colvin/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/John-Colvin/phobos/teams","hooks_url":"https://api.github.com/repos/John-Colvin/phobos/hooks","issue_events_url":"https://api.github.com/repos/John-Colvin/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/John-Colvin/phobos/events","assignees_url":"https://api.github.com/repos/John-Colvin/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/John-Colvin/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/John-Colvin/phobos/tags","blobs_url":"https://api.github.com/repos/John-Colvin/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/John-Colvin/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/John-Colvin/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/John-Colvin/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/John-Colvin/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/John-Colvin/phobos/languages","stargazers_url":"https://api.github.com/repos/John-Colvin/phobos/stargazers","contributors_url":"https://api.github.com/repos/John-Colvin/phobos/contributors","subscribers_url":"https://api.github.com/repos/John-Colvin/phobos/subscribers","subscription_url":"https://api.github.com/repos/John-Colvin/phobos/subscription","commits_url":"https://api.github.com/repos/John-Colvin/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/John-Colvin/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/John-Colvin/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/John-Colvin/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/John-Colvin/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/John-Colvin/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/John-Colvin/phobos/merges","archive_url":"https://api.github.com/repos/John-Colvin/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/John-Colvin/phobos/downloads","issues_url":"https://api.github.com/repos/John-Colvin/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/John-Colvin/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/John-Colvin/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/John-Colvin/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/John-Colvin/phobos/labels{/name}","releases_url":"https://api.github.com/repos/John-Colvin/phobos/releases{/id}","deployments_url":"https://api.github.com/repos/John-Colvin/phobos/deployments","created_at":"2013-04-01T16:32:12Z","updated_at":"2014-07-17T10:36:16Z","pushed_at":"2016-12-15T11:50:22Z","git_url":"git://github.com/John-Colvin/phobos.git","ssh_url":"git@github.com:John-Colvin/phobos.git","clone_url":"https://github.com/John-Colvin/phobos.git","svn_url":"https://github.com/John-Colvin/phobos","homepage":"dlang.org/phobos","size":47650,"stargazers_count":0,"watchers_count":0,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dlang:master","ref":"master","sha":"19445fc71e8aabdbd42f0ad8a571a57601a5ff39","user":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"repo":{"id":1257084,"name":"phobos","full_name":"dlang/phobos","owner":{"login":"dlang","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang","html_url":"https://github.com/dlang","followers_url":"https://api.github.com/users/dlang/followers","following_url":"https://api.github.com/users/dlang/following{/other_user}","gists_url":"https://api.github.com/users/dlang/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang/subscriptions","organizations_url":"https://api.github.com/users/dlang/orgs","repos_url":"https://api.github.com/users/dlang/repos","events_url":"https://api.github.com/users/dlang/events{/privacy}","received_events_url":"https://api.github.com/users/dlang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dlang/phobos","description":"The standard library of the D programming language","fork":false,"url":"https://api.github.com/repos/dlang/phobos","forks_url":"https://api.github.com/repos/dlang/phobos/forks","keys_url":"https://api.github.com/repos/dlang/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dlang/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dlang/phobos/teams","hooks_url":"https://api.github.com/repos/dlang/phobos/hooks","issue_events_url":"https://api.github.com/repos/dlang/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/dlang/phobos/events","assignees_url":"https://api.github.com/repos/dlang/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/dlang/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/dlang/phobos/tags","blobs_url":"https://api.github.com/repos/dlang/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dlang/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dlang/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/dlang/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dlang/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/dlang/phobos/languages","stargazers_url":"https://api.github.com/repos/dlang/phobos/stargazers","contributors_url":"https://api.github.com/repos/dlang/phobos/contributors","subscribers_url":"https://api.github.com/repos/dlang/phobos/subscribers","subscription_url":"https://api.github.com/repos/dlang/phobos/subscription","commits_url":"https://api.github.com/repos/dlang/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/dlang/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/dlang/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/dlang/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/dlang/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/dlang/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dlang/phobos/merges","archive_url":"https://api.github.com/repos/dlang/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dlang/phobos/downloads","issues_url":"https://api.github.com/repos/dlang/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/dlang/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/dlang/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/dlang/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dlang/phobos/labels{/name}","releases_url":"https://api.github.com/repos/dlang/phobos/releases{/id}","deployments_url":"https://api.github.com/repos/dlang/phobos/deployments","created_at":"2011-01-15T07:00:06Z","updated_at":"2016-12-12T19:24:53Z","pushed_at":"2016-12-15T16:20:35Z","git_url":"git://github.com/dlang/phobos.git","ssh_url":"git@github.com:dlang/phobos.git","clone_url":"https://github.com/dlang/phobos.git","svn_url":"https://github.com/dlang/phobos","homepage":"dlang.org/phobos","size":47633,"stargazers_count":760,"watchers_count":760,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":524,"mirror_url":null,"open_issues_count":85,"forks":524,"open_issues":85,"watchers":760,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4948"},"html":{"href":"https://github.com/dlang/phobos/pull/4948"},"issue":{"href":"https://api.github.com/repos/dlang/phobos/issues/4948"},"comments":{"href":"https://api.github.com/repos/dlang/phobos/issues/4948/comments"},"review_comments":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4948/comments"},"review_comment":{"href":"https://api.github.com/repos/dlang/phobos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dlang/phobos/pulls/4948/commits"},"statuses":{"href":"https://api.github.com/repos/dlang/phobos/statuses/eddc930aab4191b902bed3ebd874c393787d083b"}}}}
{"actor":{"display_login":"schveiguy"}}