{"action":"opened","number":10,"pull_request":{"url":"https://api.github.com/repos/sindresorhus/os-locale/pulls/10","id":43819115,"html_url":"https://github.com/sindresorhus/os-locale/pull/10","diff_url":"https://github.com/sindresorhus/os-locale/pull/10.diff","patch_url":"https://github.com/sindresorhus/os-locale/pull/10.patch","issue_url":"https://api.github.com/repos/sindresorhus/os-locale/issues/10","number":10,"state":"open","locked":false,"title":"Add option to disable spawning","user":{"login":"nexdrew","id":1929625,"avatar_url":"https://avatars.githubusercontent.com/u/1929625?v=3","gravatar_id":"","url":"https://api.github.com/users/nexdrew","html_url":"https://github.com/nexdrew","followers_url":"https://api.github.com/users/nexdrew/followers","following_url":"https://api.github.com/users/nexdrew/following{/other_user}","gists_url":"https://api.github.com/users/nexdrew/gists{/gist_id}","starred_url":"https://api.github.com/users/nexdrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nexdrew/subscriptions","organizations_url":"https://api.github.com/users/nexdrew/orgs","repos_url":"https://api.github.com/users/nexdrew/repos","events_url":"https://api.github.com/users/nexdrew/events{/privacy}","received_events_url":"https://api.github.com/users/nexdrew/received_events","type":"User","site_admin":false},"body":"Add support for `{spawn: false}`, as suggested [in yargs PR 240](https://github.com/bcoe/yargs/pull/240#discussion_r38243143) and [in os-locale issue 8](https://github.com/sindresorhus/os-locale/issues/8#issuecomment-135965626). The main use-case is for yargs, which is currently using a custom port of this library to get around undesired spawning, which can cause problems for Atom.\r\n\r\nI assumed an explicit `false` value must be used. If you'd rather let any falsey value disable spawning, I could change this:\r\n\r\n```js\r\nif (cache || getEnvLocale() || opts.spawn === false) {\r\n```\r\n\r\nTo this:\r\n\r\n```js\r\nif (cache || getEnvLocale() || (Object.prototype.hasOwnProperty.call(opts, 'spawn') && !opts.spawn)) {\r\n```\r\n\r\nTesting is a bit hacky and required an upgrade to `ava@0.1.0` (for `test.serial`), but it should work. The reason I had to introduce serial tests is due to mocking dependencies and manipulating `process.env`. I left the existing tests untouched so they still run concurrently.\r\n\r\nOne odd thing I found during testing the async API is that if `childProcess.execFile` experiences an error (meaning first argument in callback is valid), then the callback given to os-locale is not fired. I'm not sure if this is intended, but we could possibly fix by changing instances of this:\r\n\r\n```js\r\nif (err) {\r\n  fallback();\r\n  return;\r\n}\r\n```\r\n\r\nTo this:\r\n\r\n```js\r\nif (err) {\r\n  fallback();\r\n  cb(null, cache);\r\n  return;\r\n}\r\n```\r\n\r\nAs is now, the PR does not change this behavior.","created_at":"2015-08-31T22:42:05Z","updated_at":"2015-08-31T22:42:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sindresorhus/os-locale/pulls/10/commits","review_comments_url":"https://api.github.com/repos/sindresorhus/os-locale/pulls/10/comments","review_comment_url":"https://api.github.com/repos/sindresorhus/os-locale/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sindresorhus/os-locale/issues/10/comments","statuses_url":"https://api.github.com/repos/sindresorhus/os-locale/statuses/22b1d4c82cf49ff5ba2ecf085bc668942cd6bae6","head":{"label":"nexdrew:spawn-option","ref":"spawn-option","sha":"22b1d4c82cf49ff5ba2ecf085bc668942cd6bae6","user":{"login":"nexdrew","id":1929625,"avatar_url":"https://avatars.githubusercontent.com/u/1929625?v=3","gravatar_id":"","url":"https://api.github.com/users/nexdrew","html_url":"https://github.com/nexdrew","followers_url":"https://api.github.com/users/nexdrew/followers","following_url":"https://api.github.com/users/nexdrew/following{/other_user}","gists_url":"https://api.github.com/users/nexdrew/gists{/gist_id}","starred_url":"https://api.github.com/users/nexdrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nexdrew/subscriptions","organizations_url":"https://api.github.com/users/nexdrew/orgs","repos_url":"https://api.github.com/users/nexdrew/repos","events_url":"https://api.github.com/users/nexdrew/events{/privacy}","received_events_url":"https://api.github.com/users/nexdrew/received_events","type":"User","site_admin":false},"repo":{"id":41676215,"name":"os-locale","full_name":"nexdrew/os-locale","owner":{"login":"nexdrew","id":1929625,"avatar_url":"https://avatars.githubusercontent.com/u/1929625?v=3","gravatar_id":"","url":"https://api.github.com/users/nexdrew","html_url":"https://github.com/nexdrew","followers_url":"https://api.github.com/users/nexdrew/followers","following_url":"https://api.github.com/users/nexdrew/following{/other_user}","gists_url":"https://api.github.com/users/nexdrew/gists{/gist_id}","starred_url":"https://api.github.com/users/nexdrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nexdrew/subscriptions","organizations_url":"https://api.github.com/users/nexdrew/orgs","repos_url":"https://api.github.com/users/nexdrew/repos","events_url":"https://api.github.com/users/nexdrew/events{/privacy}","received_events_url":"https://api.github.com/users/nexdrew/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nexdrew/os-locale","description":"Get the system locale","fork":true,"url":"https://api.github.com/repos/nexdrew/os-locale","forks_url":"https://api.github.com/repos/nexdrew/os-locale/forks","keys_url":"https://api.github.com/repos/nexdrew/os-locale/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nexdrew/os-locale/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nexdrew/os-locale/teams","hooks_url":"https://api.github.com/repos/nexdrew/os-locale/hooks","issue_events_url":"https://api.github.com/repos/nexdrew/os-locale/issues/events{/number}","events_url":"https://api.github.com/repos/nexdrew/os-locale/events","assignees_url":"https://api.github.com/repos/nexdrew/os-locale/assignees{/user}","branches_url":"https://api.github.com/repos/nexdrew/os-locale/branches{/branch}","tags_url":"https://api.github.com/repos/nexdrew/os-locale/tags","blobs_url":"https://api.github.com/repos/nexdrew/os-locale/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nexdrew/os-locale/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nexdrew/os-locale/git/refs{/sha}","trees_url":"https://api.github.com/repos/nexdrew/os-locale/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nexdrew/os-locale/statuses/{sha}","languages_url":"https://api.github.com/repos/nexdrew/os-locale/languages","stargazers_url":"https://api.github.com/repos/nexdrew/os-locale/stargazers","contributors_url":"https://api.github.com/repos/nexdrew/os-locale/contributors","subscribers_url":"https://api.github.com/repos/nexdrew/os-locale/subscribers","subscription_url":"https://api.github.com/repos/nexdrew/os-locale/subscription","commits_url":"https://api.github.com/repos/nexdrew/os-locale/commits{/sha}","git_commits_url":"https://api.github.com/repos/nexdrew/os-locale/git/commits{/sha}","comments_url":"https://api.github.com/repos/nexdrew/os-locale/comments{/number}","issue_comment_url":"https://api.github.com/repos/nexdrew/os-locale/issues/comments{/number}","contents_url":"https://api.github.com/repos/nexdrew/os-locale/contents/{+path}","compare_url":"https://api.github.com/repos/nexdrew/os-locale/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nexdrew/os-locale/merges","archive_url":"https://api.github.com/repos/nexdrew/os-locale/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nexdrew/os-locale/downloads","issues_url":"https://api.github.com/repos/nexdrew/os-locale/issues{/number}","pulls_url":"https://api.github.com/repos/nexdrew/os-locale/pulls{/number}","milestones_url":"https://api.github.com/repos/nexdrew/os-locale/milestones{/number}","notifications_url":"https://api.github.com/repos/nexdrew/os-locale/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nexdrew/os-locale/labels{/name}","releases_url":"https://api.github.com/repos/nexdrew/os-locale/releases{/id}","created_at":"2015-08-31T13:16:24Z","updated_at":"2015-08-31T13:16:24Z","pushed_at":"2015-08-31T22:20:06Z","git_url":"git://github.com/nexdrew/os-locale.git","ssh_url":"git@github.com:nexdrew/os-locale.git","clone_url":"https://github.com/nexdrew/os-locale.git","svn_url":"https://github.com/nexdrew/os-locale","homepage":null,"size":173,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"sindresorhus:master","ref":"master","sha":"94c7ae54fdacdec7a66db5bfdb050a6f3d977fda","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"repo":{"id":32307472,"name":"os-locale","full_name":"sindresorhus/os-locale","owner":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sindresorhus/os-locale","description":"Get the system locale","fork":false,"url":"https://api.github.com/repos/sindresorhus/os-locale","forks_url":"https://api.github.com/repos/sindresorhus/os-locale/forks","keys_url":"https://api.github.com/repos/sindresorhus/os-locale/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sindresorhus/os-locale/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sindresorhus/os-locale/teams","hooks_url":"https://api.github.com/repos/sindresorhus/os-locale/hooks","issue_events_url":"https://api.github.com/repos/sindresorhus/os-locale/issues/events{/number}","events_url":"https://api.github.com/repos/sindresorhus/os-locale/events","assignees_url":"https://api.github.com/repos/sindresorhus/os-locale/assignees{/user}","branches_url":"https://api.github.com/repos/sindresorhus/os-locale/branches{/branch}","tags_url":"https://api.github.com/repos/sindresorhus/os-locale/tags","blobs_url":"https://api.github.com/repos/sindresorhus/os-locale/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sindresorhus/os-locale/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sindresorhus/os-locale/git/refs{/sha}","trees_url":"https://api.github.com/repos/sindresorhus/os-locale/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sindresorhus/os-locale/statuses/{sha}","languages_url":"https://api.github.com/repos/sindresorhus/os-locale/languages","stargazers_url":"https://api.github.com/repos/sindresorhus/os-locale/stargazers","contributors_url":"https://api.github.com/repos/sindresorhus/os-locale/contributors","subscribers_url":"https://api.github.com/repos/sindresorhus/os-locale/subscribers","subscription_url":"https://api.github.com/repos/sindresorhus/os-locale/subscription","commits_url":"https://api.github.com/repos/sindresorhus/os-locale/commits{/sha}","git_commits_url":"https://api.github.com/repos/sindresorhus/os-locale/git/commits{/sha}","comments_url":"https://api.github.com/repos/sindresorhus/os-locale/comments{/number}","issue_comment_url":"https://api.github.com/repos/sindresorhus/os-locale/issues/comments{/number}","contents_url":"https://api.github.com/repos/sindresorhus/os-locale/contents/{+path}","compare_url":"https://api.github.com/repos/sindresorhus/os-locale/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sindresorhus/os-locale/merges","archive_url":"https://api.github.com/repos/sindresorhus/os-locale/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sindresorhus/os-locale/downloads","issues_url":"https://api.github.com/repos/sindresorhus/os-locale/issues{/number}","pulls_url":"https://api.github.com/repos/sindresorhus/os-locale/pulls{/number}","milestones_url":"https://api.github.com/repos/sindresorhus/os-locale/milestones{/number}","notifications_url":"https://api.github.com/repos/sindresorhus/os-locale/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sindresorhus/os-locale/labels{/name}","releases_url":"https://api.github.com/repos/sindresorhus/os-locale/releases{/id}","created_at":"2015-03-16T07:09:09Z","updated_at":"2015-08-29T16:50:41Z","pushed_at":"2015-08-30T01:59:51Z","git_url":"git://github.com/sindresorhus/os-locale.git","ssh_url":"git@github.com:sindresorhus/os-locale.git","clone_url":"https://github.com/sindresorhus/os-locale.git","svn_url":"https://github.com/sindresorhus/os-locale","homepage":null,"size":173,"stargazers_count":30,"watchers_count":30,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":2,"forks":6,"open_issues":2,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sindresorhus/os-locale/pulls/10"},"html":{"href":"https://github.com/sindresorhus/os-locale/pull/10"},"issue":{"href":"https://api.github.com/repos/sindresorhus/os-locale/issues/10"},"comments":{"href":"https://api.github.com/repos/sindresorhus/os-locale/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/sindresorhus/os-locale/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/sindresorhus/os-locale/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sindresorhus/os-locale/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/sindresorhus/os-locale/statuses/22b1d4c82cf49ff5ba2ecf085bc668942cd6bae6"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":99,"deletions":5,"changed_files":3}}