{"action":"created","comment":{"url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/comments/38648886","id":38648886,"diff_hunk":"@@ -310,11 +319,36 @@ def run(cmd, options = {})\n       # * `:log_subject` defaults to a String representation of the Driver's\n       #   class name\n       #\n+      # Since vagrant does not support being run through bundler, we escape\n+      # any bundler environment should we detect one.  Otherwise, subcommands\n+      # will inherit our bundled environment.\n+      # @see https://github.com/test-kitchen/kitchen-vagrant/issues/190\n       # @see Kitchen::ShellOut#run_command\n       def run_command(cmd, options = {})\n         merged = {\n-          :use_sudo => config[:use_sudo], :log_subject => name\n+          :use_sudo => config[:use_sudo],\n+          :log_subject => name,\n+          :environment => {}\n         }.merge(options)\n+\n+        # Attempt to extract bundler and associated GEM related values.\n+        # TODO: To this accurately, we'd need to create a test-kitchen\n+        # launch wrapper that serializes the existing environment before\n+        # bundler touches it so that we can go back to it. Since that is\n+        # \"A Hard Problem\"(TM), we simply blow away all known bundler\n+        # related changes.\n+        env = merged[:environment]\n+        %w[BUNDLE_BIN_PATH BUNDLE_GEMFILE GEM_HOME GEM_PATH GEM_ROOT RUBY_LIB","path":"lib/kitchen/driver/vagrant.rb","position":40,"original_position":40,"commit_id":"7a82d839cc9e44fdb76332c1d6f8fbbdc3cf5611","original_commit_id":"7a82d839cc9e44fdb76332c1d6f8fbbdc3cf5611","user":{"login":"ksubrama","id":9382254,"avatar_url":"https://avatars.githubusercontent.com/u/9382254?v=3","gravatar_id":"","url":"https://api.github.com/users/ksubrama","html_url":"https://github.com/ksubrama","followers_url":"https://api.github.com/users/ksubrama/followers","following_url":"https://api.github.com/users/ksubrama/following{/other_user}","gists_url":"https://api.github.com/users/ksubrama/gists{/gist_id}","starred_url":"https://api.github.com/users/ksubrama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksubrama/subscriptions","organizations_url":"https://api.github.com/users/ksubrama/orgs","repos_url":"https://api.github.com/users/ksubrama/repos","events_url":"https://api.github.com/users/ksubrama/events{/privacy}","received_events_url":"https://api.github.com/users/ksubrama/received_events","type":"User","site_admin":false},"body":"Nope :(.  That's the approach I initially took.  Turns out with_clean_env doesn't unset GEM_* and also doesn't remove previous additions to PATH.  Bundler.with_clean_env was only designed to work within the bundler process itself (or within Gemfiles, etc.).  By the time bundler has exec-ed an underlying process, the damage is already done.  See my conversation with @sethvargo on the previous diff of this file.","created_at":"2015-09-03T14:06:20Z","updated_at":"2015-09-03T14:06:20Z","html_url":"https://github.com/test-kitchen/kitchen-vagrant/pull/191#discussion_r38648886","pull_request_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191","_links":{"self":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/comments/38648886"},"html":{"href":"https://github.com/test-kitchen/kitchen-vagrant/pull/191#discussion_r38648886"},"pull_request":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191"}}},"pull_request":{"url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191","id":43549482,"html_url":"https://github.com/test-kitchen/kitchen-vagrant/pull/191","diff_url":"https://github.com/test-kitchen/kitchen-vagrant/pull/191.diff","patch_url":"https://github.com/test-kitchen/kitchen-vagrant/pull/191.patch","issue_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues/191","number":191,"state":"open","locked":false,"title":"Escape bundler environment when shelling out to fix #190","user":{"login":"ksubrama","id":9382254,"avatar_url":"https://avatars.githubusercontent.com/u/9382254?v=3","gravatar_id":"","url":"https://api.github.com/users/ksubrama","html_url":"https://github.com/ksubrama","followers_url":"https://api.github.com/users/ksubrama/followers","following_url":"https://api.github.com/users/ksubrama/following{/other_user}","gists_url":"https://api.github.com/users/ksubrama/gists{/gist_id}","starred_url":"https://api.github.com/users/ksubrama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksubrama/subscriptions","organizations_url":"https://api.github.com/users/ksubrama/orgs","repos_url":"https://api.github.com/users/ksubrama/repos","events_url":"https://api.github.com/users/ksubrama/events{/privacy}","received_events_url":"https://api.github.com/users/ksubrama/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-27T18:20:39Z","updated_at":"2015-09-03T14:06:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d806815d4f175acd7be62e651cb7753a640daaa0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191/commits","review_comments_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191/comments","review_comment_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues/191/comments","statuses_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/statuses/7a82d839cc9e44fdb76332c1d6f8fbbdc3cf5611","head":{"label":"ksubrama:bundler","ref":"bundler","sha":"7a82d839cc9e44fdb76332c1d6f8fbbdc3cf5611","user":{"login":"ksubrama","id":9382254,"avatar_url":"https://avatars.githubusercontent.com/u/9382254?v=3","gravatar_id":"","url":"https://api.github.com/users/ksubrama","html_url":"https://github.com/ksubrama","followers_url":"https://api.github.com/users/ksubrama/followers","following_url":"https://api.github.com/users/ksubrama/following{/other_user}","gists_url":"https://api.github.com/users/ksubrama/gists{/gist_id}","starred_url":"https://api.github.com/users/ksubrama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksubrama/subscriptions","organizations_url":"https://api.github.com/users/ksubrama/orgs","repos_url":"https://api.github.com/users/ksubrama/repos","events_url":"https://api.github.com/users/ksubrama/events{/privacy}","received_events_url":"https://api.github.com/users/ksubrama/received_events","type":"User","site_admin":false},"repo":{"id":41500275,"name":"kitchen-vagrant","full_name":"ksubrama/kitchen-vagrant","owner":{"login":"ksubrama","id":9382254,"avatar_url":"https://avatars.githubusercontent.com/u/9382254?v=3","gravatar_id":"","url":"https://api.github.com/users/ksubrama","html_url":"https://github.com/ksubrama","followers_url":"https://api.github.com/users/ksubrama/followers","following_url":"https://api.github.com/users/ksubrama/following{/other_user}","gists_url":"https://api.github.com/users/ksubrama/gists{/gist_id}","starred_url":"https://api.github.com/users/ksubrama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksubrama/subscriptions","organizations_url":"https://api.github.com/users/ksubrama/orgs","repos_url":"https://api.github.com/users/ksubrama/repos","events_url":"https://api.github.com/users/ksubrama/events{/privacy}","received_events_url":"https://api.github.com/users/ksubrama/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ksubrama/kitchen-vagrant","description":"Vagrant driver for Kitchen","fork":true,"url":"https://api.github.com/repos/ksubrama/kitchen-vagrant","forks_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/forks","keys_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/teams","hooks_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/hooks","issue_events_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/issues/events{/number}","events_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/events","assignees_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/assignees{/user}","branches_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/branches{/branch}","tags_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/tags","blobs_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/git/refs{/sha}","trees_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/statuses/{sha}","languages_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/languages","stargazers_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/stargazers","contributors_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/contributors","subscribers_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/subscribers","subscription_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/subscription","commits_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/commits{/sha}","git_commits_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/git/commits{/sha}","comments_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/comments{/number}","issue_comment_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/issues/comments{/number}","contents_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/contents/{+path}","compare_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/merges","archive_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/downloads","issues_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/issues{/number}","pulls_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/pulls{/number}","milestones_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/milestones{/number}","notifications_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/labels{/name}","releases_url":"https://api.github.com/repos/ksubrama/kitchen-vagrant/releases{/id}","created_at":"2015-08-27T17:07:39Z","updated_at":"2015-08-27T17:07:39Z","pushed_at":"2015-09-02T19:16:50Z","git_url":"git://github.com/ksubrama/kitchen-vagrant.git","ssh_url":"git@github.com:ksubrama/kitchen-vagrant.git","clone_url":"https://github.com/ksubrama/kitchen-vagrant.git","svn_url":"https://github.com/ksubrama/kitchen-vagrant","homepage":null,"size":389,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"test-kitchen:master","ref":"master","sha":"3d8d9f0e8c8cb2b73108452401b33b613deea62e","user":{"login":"test-kitchen","id":5924439,"avatar_url":"https://avatars.githubusercontent.com/u/5924439?v=3","gravatar_id":"","url":"https://api.github.com/users/test-kitchen","html_url":"https://github.com/test-kitchen","followers_url":"https://api.github.com/users/test-kitchen/followers","following_url":"https://api.github.com/users/test-kitchen/following{/other_user}","gists_url":"https://api.github.com/users/test-kitchen/gists{/gist_id}","starred_url":"https://api.github.com/users/test-kitchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/test-kitchen/subscriptions","organizations_url":"https://api.github.com/users/test-kitchen/orgs","repos_url":"https://api.github.com/users/test-kitchen/repos","events_url":"https://api.github.com/users/test-kitchen/events{/privacy}","received_events_url":"https://api.github.com/users/test-kitchen/received_events","type":"Organization","site_admin":false},"repo":{"id":7887296,"name":"kitchen-vagrant","full_name":"test-kitchen/kitchen-vagrant","owner":{"login":"test-kitchen","id":5924439,"avatar_url":"https://avatars.githubusercontent.com/u/5924439?v=3","gravatar_id":"","url":"https://api.github.com/users/test-kitchen","html_url":"https://github.com/test-kitchen","followers_url":"https://api.github.com/users/test-kitchen/followers","following_url":"https://api.github.com/users/test-kitchen/following{/other_user}","gists_url":"https://api.github.com/users/test-kitchen/gists{/gist_id}","starred_url":"https://api.github.com/users/test-kitchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/test-kitchen/subscriptions","organizations_url":"https://api.github.com/users/test-kitchen/orgs","repos_url":"https://api.github.com/users/test-kitchen/repos","events_url":"https://api.github.com/users/test-kitchen/events{/privacy}","received_events_url":"https://api.github.com/users/test-kitchen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/test-kitchen/kitchen-vagrant","description":"Vagrant driver for Kitchen","fork":false,"url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant","forks_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/forks","keys_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/teams","hooks_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/hooks","issue_events_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues/events{/number}","events_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/events","assignees_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/assignees{/user}","branches_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/branches{/branch}","tags_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/tags","blobs_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/git/refs{/sha}","trees_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/statuses/{sha}","languages_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/languages","stargazers_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/stargazers","contributors_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/contributors","subscribers_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/subscribers","subscription_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/subscription","commits_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/commits{/sha}","git_commits_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/git/commits{/sha}","comments_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/comments{/number}","issue_comment_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues/comments{/number}","contents_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/contents/{+path}","compare_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/merges","archive_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/downloads","issues_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues{/number}","pulls_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls{/number}","milestones_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/milestones{/number}","notifications_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/labels{/name}","releases_url":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/releases{/id}","created_at":"2013-01-29T07:12:57Z","updated_at":"2015-08-25T00:54:06Z","pushed_at":"2015-09-02T19:16:51Z","git_url":"git://github.com/test-kitchen/kitchen-vagrant.git","ssh_url":"git@github.com:test-kitchen/kitchen-vagrant.git","clone_url":"https://github.com/test-kitchen/kitchen-vagrant.git","svn_url":"https://github.com/test-kitchen/kitchen-vagrant","homepage":null,"size":1392,"stargazers_count":173,"watchers_count":173,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":32,"forks":132,"open_issues":32,"watchers":173,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191"},"html":{"href":"https://github.com/test-kitchen/kitchen-vagrant/pull/191"},"issue":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues/191"},"comments":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191/comments"},"review_comment":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/pulls/191/commits"},"statuses":{"href":"https://api.github.com/repos/test-kitchen/kitchen-vagrant/statuses/7a82d839cc9e44fdb76332c1d6f8fbbdc3cf5611"}}}}