{"action":"created","issue":{"url":"https://api.github.com/repos/stefanjudis/grunt-jsinspect/issues/34","labels_url":"https://api.github.com/repos/stefanjudis/grunt-jsinspect/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/stefanjudis/grunt-jsinspect/issues/34/comments","events_url":"https://api.github.com/repos/stefanjudis/grunt-jsinspect/issues/34/events","html_url":"https://github.com/stefanjudis/grunt-jsinspect/issues/34","id":111612348,"number":34,"title":"outputPath does not create intermediate folders","user":{"login":"wingedfox","id":3115059,"avatar_url":"https://avatars.githubusercontent.com/u/3115059?v=3","gravatar_id":"","url":"https://api.github.com/users/wingedfox","html_url":"https://github.com/wingedfox","followers_url":"https://api.github.com/users/wingedfox/followers","following_url":"https://api.github.com/users/wingedfox/following{/other_user}","gists_url":"https://api.github.com/users/wingedfox/gists{/gist_id}","starred_url":"https://api.github.com/users/wingedfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wingedfox/subscriptions","organizations_url":"https://api.github.com/users/wingedfox/orgs","repos_url":"https://api.github.com/users/wingedfox/repos","events_url":"https://api.github.com/users/wingedfox/events{/privacy}","received_events_url":"https://api.github.com/users/wingedfox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-15T13:07:36Z","updated_at":"2015-10-15T13:09:49Z","closed_at":null,"body":"Providing\r\n```\r\noutputPath: target/reports/jsinspect/output.xml'\r\n```\r\nI need to create all intermediate folders prior to run of the task, because\r\n```\r\n fs.createWriteStream(options.outputPath, {encoding: 'utf8', flags: 'w'});\r\n```\r\ndoes not create them internally and always fails with \r\n```\r\nFatal error: ENOENT, open 'target/reports/jsinspect/output.xml'\r\n```\r\n\r\nThis is a side-effect of execution of\r\n```\r\ninspector.run();\r\n```\r\nwithout prior check for success stream open.\r\nI suggest to fix that the following way\r\n```\r\n    if (writableStream) {\r\n      writableStream.on('finish', function() {\r\n        done(taskSucceeded);\r\n      });\r\n      writableStream.on('open', function() {\r\n        inspector.run();\r\n      });\r\n    } else {\r\n      inspector.on('end', function() {\r\n        done(taskSucceeded);\r\n      });\r\n      inspector.run();\r\n    }\r\n```\r\nand process  writableStream.on('error' for early error reporting."},"comment":{"url":"https://api.github.com/repos/stefanjudis/grunt-jsinspect/issues/comments/148379521","html_url":"https://github.com/stefanjudis/grunt-jsinspect/issues/34#issuecomment-148379521","issue_url":"https://api.github.com/repos/stefanjudis/grunt-jsinspect/issues/34","id":148379521,"user":{"login":"paazmaya","id":369881,"avatar_url":"https://avatars.githubusercontent.com/u/369881?v=3","gravatar_id":"","url":"https://api.github.com/users/paazmaya","html_url":"https://github.com/paazmaya","followers_url":"https://api.github.com/users/paazmaya/followers","following_url":"https://api.github.com/users/paazmaya/following{/other_user}","gists_url":"https://api.github.com/users/paazmaya/gists{/gist_id}","starred_url":"https://api.github.com/users/paazmaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paazmaya/subscriptions","organizations_url":"https://api.github.com/users/paazmaya/orgs","repos_url":"https://api.github.com/users/paazmaya/repos","events_url":"https://api.github.com/users/paazmaya/events{/privacy}","received_events_url":"https://api.github.com/users/paazmaya/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T13:09:49Z","updated_at":"2015-10-15T13:09:49Z","body":"Would you suggest that the plugin would use something similar to `mkdir -p` ?"}}