{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/5855","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/5855/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5855/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/5855/events","html_url":"https://github.com/nodejs/node/issues/5855","id":142848656,"number":5855,"title":"I am getting this error when I execute my script in Nodejs","user":{"login":"sernapallyanurag","id":8936085,"avatar_url":"https://avatars.githubusercontent.com/u/8936085?v=3","gravatar_id":"","url":"https://api.github.com/users/sernapallyanurag","html_url":"https://github.com/sernapallyanurag","followers_url":"https://api.github.com/users/sernapallyanurag/followers","following_url":"https://api.github.com/users/sernapallyanurag/following{/other_user}","gists_url":"https://api.github.com/users/sernapallyanurag/gists{/gist_id}","starred_url":"https://api.github.com/users/sernapallyanurag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sernapallyanurag/subscriptions","organizations_url":"https://api.github.com/users/sernapallyanurag/orgs","repos_url":"https://api.github.com/users/sernapallyanurag/repos","events_url":"https://api.github.com/users/sernapallyanurag/events{/privacy}","received_events_url":"https://api.github.com/users/sernapallyanurag/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/child_process","name":"child_process","color":"f7c6c7"},{"url":"https://api.github.com/repos/nodejs/node/labels/windows","name":"windows","color":"9944dd"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-03-23T03:30:41Z","updated_at":"2016-04-04T10:20:09Z","closed_at":null,"body":"OS: Windows 7\r\nCode: \r\n ``` exports.testscript=function(req,res){\r\n\tvar exec = require('child_process').exec;\r\n\tconsole.log(\"inside function\");\r\n\t var child = exec('powershell.exe chef-apply azurepro.rb' ,{cwd: 'C:\\Users\\xyz\\chef-repo'},\r\n\t    function(error, stdout, stderr){\r\n\t    console.log(stdout); \r\n\t    console.log(stderr); \r\n\t    if (error !== null) {\r\n\t      console.log(error);\r\n\t    }\r\n\t\t\t});\r\n\t\r\n\t//child.stdin.end();\r\n};\r\n\r\n\r\n```\r\nerror:\r\n\r\n```\r\nC:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/defaults/operating_system.rb:28:in `expand_path': no implicit conversion of nil into String (TypeError)\r\n{ [Error: Command failed: cmd.exe /s /c \"chef-apply C:\\\\Users\\\\xyz\\\\chef-repo\\\\azurepro.rb \"\r\n```\r\n\r\nthis is due to \",\" in exec(). I tried putting it in +\",\"+ but doesn't give any output if I do so. Can you suggest me a way to separate **function(error, stdout, stderr)** like in Spawn\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/205230682","html_url":"https://github.com/nodejs/node/issues/5855#issuecomment-205230682","issue_url":"https://api.github.com/repos/nodejs/node/issues/5855","id":205230682,"user":{"login":"sernapallyanurag","id":8936085,"avatar_url":"https://avatars.githubusercontent.com/u/8936085?v=3","gravatar_id":"","url":"https://api.github.com/users/sernapallyanurag","html_url":"https://github.com/sernapallyanurag","followers_url":"https://api.github.com/users/sernapallyanurag/followers","following_url":"https://api.github.com/users/sernapallyanurag/following{/other_user}","gists_url":"https://api.github.com/users/sernapallyanurag/gists{/gist_id}","starred_url":"https://api.github.com/users/sernapallyanurag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sernapallyanurag/subscriptions","organizations_url":"https://api.github.com/users/sernapallyanurag/orgs","repos_url":"https://api.github.com/users/sernapallyanurag/repos","events_url":"https://api.github.com/users/sernapallyanurag/events{/privacy}","received_events_url":"https://api.github.com/users/sernapallyanurag/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T10:20:09Z","updated_at":"2016-04-04T10:20:09Z","body":"@cjihrig  I am not getting any error when I use ``spawn()``. I am getting an error when I am using ``exec()``.  `` 'cmd.exe /s /c chef-apply azurepro.rb`` works fine."}}