{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef/issues/3883","labels_url":"https://api.github.com/repos/chef/chef/issues/3883/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef/issues/3883/comments","events_url":"https://api.github.com/repos/chef/chef/issues/3883/events","html_url":"https://github.com/chef/chef/issues/3883","id":105075220,"number":3883,"title":"powershell_script fails converge when temporary script directory contains whitespace","user":{"login":"JonathanPorta","id":1451007,"avatar_url":"https://avatars.githubusercontent.com/u/1451007?v=3","gravatar_id":"","url":"https://api.github.com/users/JonathanPorta","html_url":"https://github.com/JonathanPorta","followers_url":"https://api.github.com/users/JonathanPorta/followers","following_url":"https://api.github.com/users/JonathanPorta/following{/other_user}","gists_url":"https://api.github.com/users/JonathanPorta/gists{/gist_id}","starred_url":"https://api.github.com/users/JonathanPorta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonathanPorta/subscriptions","organizations_url":"https://api.github.com/users/JonathanPorta/orgs","repos_url":"https://api.github.com/users/JonathanPorta/repos","events_url":"https://api.github.com/users/JonathanPorta/events{/privacy}","received_events_url":"https://api.github.com/users/JonathanPorta/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chef/chef/labels/Windows","name":"Windows","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/chef/chef/milestones/25","html_url":"https://github.com/chef/chef/milestones/12.6.0","labels_url":"https://api.github.com/repos/chef/chef/milestones/25/labels","id":1330301,"number":25,"title":"12.6.0","description":null,"creator":{"login":"lamont-granquist","id":454857,"avatar_url":"https://avatars.githubusercontent.com/u/454857?v=3","gravatar_id":"","url":"https://api.github.com/users/lamont-granquist","html_url":"https://github.com/lamont-granquist","followers_url":"https://api.github.com/users/lamont-granquist/followers","following_url":"https://api.github.com/users/lamont-granquist/following{/other_user}","gists_url":"https://api.github.com/users/lamont-granquist/gists{/gist_id}","starred_url":"https://api.github.com/users/lamont-granquist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lamont-granquist/subscriptions","organizations_url":"https://api.github.com/users/lamont-granquist/orgs","repos_url":"https://api.github.com/users/lamont-granquist/repos","events_url":"https://api.github.com/users/lamont-granquist/events{/privacy}","received_events_url":"https://api.github.com/users/lamont-granquist/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-09-30T01:04:42Z","updated_at":"2015-10-05T22:12:43Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-09-06T06:37:36Z","updated_at":"2015-10-05T22:13:59Z","closed_at":null,"body":"### Version:\r\nChef Development Kit Version: 0.4.0\r\nChef: 12.4.1\r\n\r\n### Environment:\r\nWindows 10\r\n\r\n### Scenario:\r\nThe temporary PowerShell file that Chef creates for a new powershell_script resource will fail to execute if the temp directory has a space somewhere in the path.\r\n\r\n\r\n### Steps to Reproduce:\r\nIn my scenario, my user name has a space. Chef seems to default to using a temp directory that is in my windows user directory: `C:/Users/Jonathan Porta/AppData/Local/Temp/chef_powershell_script-user-code20150905-4484-1ks7zh4.ps1`\r\n\r\n\r\n\r\n### Expected Result:\r\nPath to the temporary powershell script should have any whitespace escaped and, ultimately, execute.\r\n\r\n\r\n### Actual Result:\r\nThe most telling part of the error looks like this:\r\n\r\n```\r\nExpected process to exit with [0], but received '1'\r\n      ---- Begin output of \"powershell.exe\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -Command C:/Users/Jonathan Porta/AppData/Local/Temp/chef_powershell_script-user-code20150905-4484-1ks7zh4.ps1 ----\r\n      STDOUT:\r\n====> STDERR: C:/Users/Jonathan : The term 'C:/Users/Jonathan' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct\r\n      and try again.\r\n```\r\n\r\nDump of the whole error:\r\n\r\n```     ================================================================================\r\n      Error executing action `run` on resource 'powershell_script[Installing Steam app 258550]'\r\n      ================================================================================\r\n\r\n      Mixlib::ShellOut::ShellCommandFailed\r\n      ------------------------------------\r\n      Expected process to exit with [0], but received '1'\r\n      ---- Begin output of \"powershell.exe\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -Command C:/Users/Jonathan Porta/AppData/Local/Temp/chef_powershell_script-user-code20150905-4484-1ks7zh4.ps1 ----\r\n      STDOUT:\r\n      STDERR: C:/Users/Jonathan : The term 'C:/Users/Jonathan' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct\r\n      and try again.\r\n      At line:1 char:1\r\n      + C:/Users/Jonathan Porta/AppData/Local/Temp/chef_powershell_script-use ...\r\n      + ~~~~~~~~~~~~~~~~~\r\n          + CategoryInfo          : ObjectNotFound: (C:/Users/Jonathan:String) [], CommandNotFoundException\r\n          + FullyQualifiedErrorId : CommandNotFoundException\r\n      ---- End output of \"powershell.exe\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -Command C:/Users/Jonathan Porta/AppData/Local/Temp/chef_powershell_script-user-code20150905-4484-1ks7zh4.ps1 ----\r\n      Ran \"powershell.exe\" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -Command C:/Users/Jonathan Porta/AppData/Local/Temp/chef_powershell_script-user-code20150905-4484-1ks7zh4.ps1 returned 1\r\n\r\n      Compiled Resource:\r\n      ------------------\r\n      # Declared in\r\n\r\n      powershell_script(\"Installing Steam app 258550\") do\r\n        action [:run]\r\n        retries 0\r\n        retry_delay 2\r\n        default_guard_interpreter :powershell_script\r\n        command \"Installing Steam app 258550\"\r\n        backup 5\r\n        returns 0\r\n        interpreter \"powershell.exe\"\r\n      end\r\n```"},"comment":{"url":"https://api.github.com/repos/chef/chef/issues/comments/145684949","html_url":"https://github.com/chef/chef/issues/3883#issuecomment-145684949","issue_url":"https://api.github.com/repos/chef/chef/issues/3883","id":145684949,"user":{"login":"adamedx","id":2422125,"avatar_url":"https://avatars.githubusercontent.com/u/2422125?v=3","gravatar_id":"","url":"https://api.github.com/users/adamedx","html_url":"https://github.com/adamedx","followers_url":"https://api.github.com/users/adamedx/followers","following_url":"https://api.github.com/users/adamedx/following{/other_user}","gists_url":"https://api.github.com/users/adamedx/gists{/gist_id}","starred_url":"https://api.github.com/users/adamedx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamedx/subscriptions","organizations_url":"https://api.github.com/users/adamedx/orgs","repos_url":"https://api.github.com/users/adamedx/repos","events_url":"https://api.github.com/users/adamedx/events{/privacy}","received_events_url":"https://api.github.com/users/adamedx/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T22:13:59Z","updated_at":"2015-10-05T22:13:59Z","body":"Thanks  @JonathanPorta -- this is most likely to be a problem on ChefDK where usernames are more likely to have spaces."}}