{"action":"created","comment":{"url":"https://api.github.com/repos/bryphe/esy-bash/pulls/comments/221714876","pull_request_review_id":160431957,"id":221714876,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTcxNDg3Ng==","diff_hunk":"@@ -0,0 +1,111 @@\n+exception InvalidEnvJSON(string);\n+exception InvariantViolation(unit);\n+\n+let pathDelimStr = Sys.os_type == \"Unix\" ? \"/\" : \"\\\\\";\n+let pathDelimChr = pathDelimStr.[0];\n+\n+let normalizePath = str =>\n+  String.concat(\"/\", String.split_on_char(pathDelimChr, str));\n+\n+let normalizeEndlines = str =>\n+  String.concat(\"\\n\", Str.split(Str.regexp(\"\\r\\n\"), str));\n+\n+let remapPathsInEnvironment = envVars =>\n+  Array.map(\n+    envVar =>\n+      switch (String.split_on_char('=', envVar)) {\n+      | [k, v, ...rest] =>\n+        if (String.lowercase_ascii(k) == \"path\") {\n+          \"PATH=\" ++ normalizePath(v);\n+        } else {\n+          k ++ \"=\" ++ v;\n+        }\n+      | _ => raise(InvariantViolation())\n+      },\n+    envVars,\n+  );\n+\n+let collectKeyValuePairs = jsonKeyValuePairs =>\n+  List.map(\n+    pair => {\n+      let (k, jsonValue) = pair;\n+      switch (jsonValue) {\n+      | `String(a) => k ++ \"=\" ++ a\n+      | _ => raise(InvalidEnvJSON(\"Not a valid env json file\"))\n+      };\n+    },\n+    jsonKeyValuePairs,\n+  );\n+\n+let rec traverse = json =>\n+  switch (json) {\n+  | `Assoc(keyValuePairs) => collectKeyValuePairs(keyValuePairs)\n+  | _ => raise(InvalidEnvJSON(\"Not a valid env json file\"))\n+  };\n+\n+let extractEnvironmentVariables = environmentFile => {\n+  let json = Yojson.Basic.from_file(environmentFile);\n+  traverse(json);\n+};\n+\n+let nonce = ref(0);\n+let bashExec = (~environmentFile=?, command) => {\n+  let shellPath =\n+    Sys.os_type == \"Unix\" ? \"/bin/bash\" : \"C:\\\\cygwin\\\\bin\\\\bash.exe\"; /* \"..\\\\.cygwin\\\\bin.bash.exe\"; */","path":"re/lib/EsyBashLib.re","position":54,"original_position":54,"commit_id":"2c23a8a47ab016fa92b364ae7651bdaf22352847","original_commit_id":"43ca745ea2271b915bb656b136c545dc2bbbd655","user":{"login":"bryphe","id":13532591,"node_id":"MDQ6VXNlcjEzNTMyNTkx","avatar_url":"https://avatars1.githubusercontent.com/u/13532591?v=4","gravatar_id":"","url":"https://api.github.com/users/bryphe","html_url":"https://github.com/bryphe","followers_url":"https://api.github.com/users/bryphe/followers","following_url":"https://api.github.com/users/bryphe/following{/other_user}","gists_url":"https://api.github.com/users/bryphe/gists{/gist_id}","starred_url":"https://api.github.com/users/bryphe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryphe/subscriptions","organizations_url":"https://api.github.com/users/bryphe/orgs","repos_url":"https://api.github.com/users/bryphe/repos","events_url":"https://api.github.com/users/bryphe/events{/privacy}","received_events_url":"https://api.github.com/users/bryphe/received_events","type":"User","site_admin":false},"body":"We can do something like we do for `esy-bash` - go to a directory relative to the executable: https://github.com/esy/esy/blob/f31156f1c5385b5d3b19e2d812c1dd39228bc6eb/esy-lib/EsyBash.re#L14\r\n\r\nIn this case, we'd know exactly where the bash executable will be relative to our executable.","created_at":"2018-10-01T18:42:37Z","updated_at":"2018-10-01T18:42:38Z","html_url":"https://github.com/bryphe/esy-bash/pull/19#discussion_r221714876","pull_request_url":"https://api.github.com/repos/bryphe/esy-bash/pulls/19","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/bryphe/esy-bash/pulls/comments/221714876"},"html":{"href":"https://github.com/bryphe/esy-bash/pull/19#discussion_r221714876"},"pull_request":{"href":"https://api.github.com/repos/bryphe/esy-bash/pulls/19"}},"in_reply_to_id":221681553},"pull_request":{"url":"https://api.github.com/repos/bryphe/esy-bash/pulls/19","id":219134647,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTM0NjQ3","html_url":"https://github.com/bryphe/esy-bash/pull/19","diff_url":"https://github.com/bryphe/esy-bash/pull/19.diff","patch_url":"https://github.com/bryphe/esy-bash/pull/19.patch","issue_url":"https://api.github.com/repos/bryphe/esy-bash/issues/19","number":19,"state":"open","locked":false,"title":"Native esy bash","user":{"login":"prometheansacrifice","id":3097018,"node_id":"MDQ6VXNlcjMwOTcwMTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3097018?v=4","gravatar_id":"","url":"https://api.github.com/users/prometheansacrifice","html_url":"https://github.com/prometheansacrifice","followers_url":"https://api.github.com/users/prometheansacrifice/followers","following_url":"https://api.github.com/users/prometheansacrifice/following{/other_user}","gists_url":"https://api.github.com/users/prometheansacrifice/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheansacrifice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheansacrifice/subscriptions","organizations_url":"https://api.github.com/users/prometheansacrifice/orgs","repos_url":"https://api.github.com/users/prometheansacrifice/repos","events_url":"https://api.github.com/users/prometheansacrifice/events{/privacy}","received_events_url":"https://api.github.com/users/prometheansacrifice/received_events","type":"User","site_admin":false},"body":"Addresses #16 ","created_at":"2018-09-29T08:29:57Z","updated_at":"2018-10-01T18:42:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ddde4c38988263d3e0a476c3f852dc84a0bca11","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bryphe/esy-bash/pulls/19/commits","review_comments_url":"https://api.github.com/repos/bryphe/esy-bash/pulls/19/comments","review_comment_url":"https://api.github.com/repos/bryphe/esy-bash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bryphe/esy-bash/issues/19/comments","statuses_url":"https://api.github.com/repos/bryphe/esy-bash/statuses/2c23a8a47ab016fa92b364ae7651bdaf22352847","head":{"label":"prometheansacrifice:native-esy-bash","ref":"native-esy-bash","sha":"2c23a8a47ab016fa92b364ae7651bdaf22352847","user":{"login":"prometheansacrifice","id":3097018,"node_id":"MDQ6VXNlcjMwOTcwMTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3097018?v=4","gravatar_id":"","url":"https://api.github.com/users/prometheansacrifice","html_url":"https://github.com/prometheansacrifice","followers_url":"https://api.github.com/users/prometheansacrifice/followers","following_url":"https://api.github.com/users/prometheansacrifice/following{/other_user}","gists_url":"https://api.github.com/users/prometheansacrifice/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheansacrifice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheansacrifice/subscriptions","organizations_url":"https://api.github.com/users/prometheansacrifice/orgs","repos_url":"https://api.github.com/users/prometheansacrifice/repos","events_url":"https://api.github.com/users/prometheansacrifice/events{/privacy}","received_events_url":"https://api.github.com/users/prometheansacrifice/received_events","type":"User","site_admin":false},"repo":{"id":150430396,"node_id":"MDEwOlJlcG9zaXRvcnkxNTA0MzAzOTY=","name":"esy-bash","full_name":"prometheansacrifice/esy-bash","private":false,"owner":{"login":"prometheansacrifice","id":3097018,"node_id":"MDQ6VXNlcjMwOTcwMTg=","avatar_url":"https://avatars0.githubusercontent.com/u/3097018?v=4","gravatar_id":"","url":"https://api.github.com/users/prometheansacrifice","html_url":"https://github.com/prometheansacrifice","followers_url":"https://api.github.com/users/prometheansacrifice/followers","following_url":"https://api.github.com/users/prometheansacrifice/following{/other_user}","gists_url":"https://api.github.com/users/prometheansacrifice/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheansacrifice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheansacrifice/subscriptions","organizations_url":"https://api.github.com/users/prometheansacrifice/orgs","repos_url":"https://api.github.com/users/prometheansacrifice/repos","events_url":"https://api.github.com/users/prometheansacrifice/events{/privacy}","received_events_url":"https://api.github.com/users/prometheansacrifice/received_events","type":"User","site_admin":false},"html_url":"https://github.com/prometheansacrifice/esy-bash","description":"Installation utilities for Cygwin - primed for Reason/OCaml","fork":true,"url":"https://api.github.com/repos/prometheansacrifice/esy-bash","forks_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/forks","keys_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/teams","hooks_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/hooks","issue_events_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/issues/events{/number}","events_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/events","assignees_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/assignees{/user}","branches_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/branches{/branch}","tags_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/tags","blobs_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/git/refs{/sha}","trees_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/statuses/{sha}","languages_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/languages","stargazers_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/stargazers","contributors_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/contributors","subscribers_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/subscribers","subscription_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/subscription","commits_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/commits{/sha}","git_commits_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/git/commits{/sha}","comments_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/comments{/number}","issue_comment_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/issues/comments{/number}","contents_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/contents/{+path}","compare_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/merges","archive_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/downloads","issues_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/issues{/number}","pulls_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/pulls{/number}","milestones_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/milestones{/number}","notifications_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/labels{/name}","releases_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/releases{/id}","deployments_url":"https://api.github.com/repos/prometheansacrifice/esy-bash/deployments","created_at":"2018-09-26T13:23:48Z","updated_at":"2018-09-26T13:23:50Z","pushed_at":"2018-10-01T17:16:35Z","git_url":"git://github.com/prometheansacrifice/esy-bash.git","ssh_url":"git@github.com:prometheansacrifice/esy-bash.git","clone_url":"https://github.com/prometheansacrifice/esy-bash.git","svn_url":"https://github.com/prometheansacrifice/esy-bash","homepage":null,"size":164,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bryphe:master","ref":"master","sha":"e1e81e772fb006faf32549daa9fca13cc1653c8d","user":{"login":"bryphe","id":13532591,"node_id":"MDQ6VXNlcjEzNTMyNTkx","avatar_url":"https://avatars1.githubusercontent.com/u/13532591?v=4","gravatar_id":"","url":"https://api.github.com/users/bryphe","html_url":"https://github.com/bryphe","followers_url":"https://api.github.com/users/bryphe/followers","following_url":"https://api.github.com/users/bryphe/following{/other_user}","gists_url":"https://api.github.com/users/bryphe/gists{/gist_id}","starred_url":"https://api.github.com/users/bryphe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryphe/subscriptions","organizations_url":"https://api.github.com/users/bryphe/orgs","repos_url":"https://api.github.com/users/bryphe/repos","events_url":"https://api.github.com/users/bryphe/events{/privacy}","received_events_url":"https://api.github.com/users/bryphe/received_events","type":"User","site_admin":false},"repo":{"id":138354667,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgzNTQ2Njc=","name":"esy-bash","full_name":"bryphe/esy-bash","private":false,"owner":{"login":"bryphe","id":13532591,"node_id":"MDQ6VXNlcjEzNTMyNTkx","avatar_url":"https://avatars1.githubusercontent.com/u/13532591?v=4","gravatar_id":"","url":"https://api.github.com/users/bryphe","html_url":"https://github.com/bryphe","followers_url":"https://api.github.com/users/bryphe/followers","following_url":"https://api.github.com/users/bryphe/following{/other_user}","gists_url":"https://api.github.com/users/bryphe/gists{/gist_id}","starred_url":"https://api.github.com/users/bryphe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryphe/subscriptions","organizations_url":"https://api.github.com/users/bryphe/orgs","repos_url":"https://api.github.com/users/bryphe/repos","events_url":"https://api.github.com/users/bryphe/events{/privacy}","received_events_url":"https://api.github.com/users/bryphe/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bryphe/esy-bash","description":"Installation utilities for Cygwin - primed for Reason/OCaml","fork":false,"url":"https://api.github.com/repos/bryphe/esy-bash","forks_url":"https://api.github.com/repos/bryphe/esy-bash/forks","keys_url":"https://api.github.com/repos/bryphe/esy-bash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bryphe/esy-bash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bryphe/esy-bash/teams","hooks_url":"https://api.github.com/repos/bryphe/esy-bash/hooks","issue_events_url":"https://api.github.com/repos/bryphe/esy-bash/issues/events{/number}","events_url":"https://api.github.com/repos/bryphe/esy-bash/events","assignees_url":"https://api.github.com/repos/bryphe/esy-bash/assignees{/user}","branches_url":"https://api.github.com/repos/bryphe/esy-bash/branches{/branch}","tags_url":"https://api.github.com/repos/bryphe/esy-bash/tags","blobs_url":"https://api.github.com/repos/bryphe/esy-bash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bryphe/esy-bash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bryphe/esy-bash/git/refs{/sha}","trees_url":"https://api.github.com/repos/bryphe/esy-bash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bryphe/esy-bash/statuses/{sha}","languages_url":"https://api.github.com/repos/bryphe/esy-bash/languages","stargazers_url":"https://api.github.com/repos/bryphe/esy-bash/stargazers","contributors_url":"https://api.github.com/repos/bryphe/esy-bash/contributors","subscribers_url":"https://api.github.com/repos/bryphe/esy-bash/subscribers","subscription_url":"https://api.github.com/repos/bryphe/esy-bash/subscription","commits_url":"https://api.github.com/repos/bryphe/esy-bash/commits{/sha}","git_commits_url":"https://api.github.com/repos/bryphe/esy-bash/git/commits{/sha}","comments_url":"https://api.github.com/repos/bryphe/esy-bash/comments{/number}","issue_comment_url":"https://api.github.com/repos/bryphe/esy-bash/issues/comments{/number}","contents_url":"https://api.github.com/repos/bryphe/esy-bash/contents/{+path}","compare_url":"https://api.github.com/repos/bryphe/esy-bash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bryphe/esy-bash/merges","archive_url":"https://api.github.com/repos/bryphe/esy-bash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bryphe/esy-bash/downloads","issues_url":"https://api.github.com/repos/bryphe/esy-bash/issues{/number}","pulls_url":"https://api.github.com/repos/bryphe/esy-bash/pulls{/number}","milestones_url":"https://api.github.com/repos/bryphe/esy-bash/milestones{/number}","notifications_url":"https://api.github.com/repos/bryphe/esy-bash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bryphe/esy-bash/labels{/name}","releases_url":"https://api.github.com/repos/bryphe/esy-bash/releases{/id}","deployments_url":"https://api.github.com/repos/bryphe/esy-bash/deployments","created_at":"2018-06-22T22:51:06Z","updated_at":"2018-09-20T17:02:31Z","pushed_at":"2018-10-01T17:16:36Z","git_url":"git://github.com/bryphe/esy-bash.git","ssh_url":"git@github.com:bryphe/esy-bash.git","clone_url":"https://github.com/bryphe/esy-bash.git","svn_url":"https://github.com/bryphe/esy-bash","homepage":null,"size":106,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bryphe/esy-bash/pulls/19"},"html":{"href":"https://github.com/bryphe/esy-bash/pull/19"},"issue":{"href":"https://api.github.com/repos/bryphe/esy-bash/issues/19"},"comments":{"href":"https://api.github.com/repos/bryphe/esy-bash/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/bryphe/esy-bash/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/bryphe/esy-bash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bryphe/esy-bash/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/bryphe/esy-bash/statuses/2c23a8a47ab016fa92b364ae7651bdaf22352847"}},"author_association":"NONE"}}
{"actor":{"display_login":"bryphe"}}