{"action":"created","issue":{"url":"https://api.github.com/repos/marcbachmann/node-html-pdf/issues/145","repository_url":"https://api.github.com/repos/marcbachmann/node-html-pdf","labels_url":"https://api.github.com/repos/marcbachmann/node-html-pdf/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/marcbachmann/node-html-pdf/issues/145/comments","events_url":"https://api.github.com/repos/marcbachmann/node-html-pdf/issues/145/events","html_url":"https://github.com/marcbachmann/node-html-pdf/pull/145","id":159484958,"number":145,"title":"Handle spawn errors gracefully.","user":{"login":"westy92","id":290167,"avatar_url":"https://avatars.githubusercontent.com/u/290167?v=3","gravatar_id":"","url":"https://api.github.com/users/westy92","html_url":"https://github.com/westy92","followers_url":"https://api.github.com/users/westy92/followers","following_url":"https://api.github.com/users/westy92/following{/other_user}","gists_url":"https://api.github.com/users/westy92/gists{/gist_id}","starred_url":"https://api.github.com/users/westy92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westy92/subscriptions","organizations_url":"https://api.github.com/users/westy92/orgs","repos_url":"https://api.github.com/users/westy92/repos","events_url":"https://api.github.com/users/westy92/events{/privacy}","received_events_url":"https://api.github.com/users/westy92/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-09T19:09:19Z","updated_at":"2016-06-09T19:50:15Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/marcbachmann/node-html-pdf/pulls/145","html_url":"https://github.com/marcbachmann/node-html-pdf/pull/145","diff_url":"https://github.com/marcbachmann/node-html-pdf/pull/145.diff","patch_url":"https://github.com/marcbachmann/node-html-pdf/pull/145.patch"},"body":"If an invalid options.phantomPath was provided, the entire application would crash.  Now it handles errors gracefully and passes them to the callback."},"comment":{"url":"https://api.github.com/repos/marcbachmann/node-html-pdf/issues/comments/225006302","html_url":"https://github.com/marcbachmann/node-html-pdf/pull/145#issuecomment-225006302","issue_url":"https://api.github.com/repos/marcbachmann/node-html-pdf/issues/145","id":225006302,"user":{"login":"marcbachmann","id":431376,"avatar_url":"https://avatars.githubusercontent.com/u/431376?v=3","gravatar_id":"","url":"https://api.github.com/users/marcbachmann","html_url":"https://github.com/marcbachmann","followers_url":"https://api.github.com/users/marcbachmann/followers","following_url":"https://api.github.com/users/marcbachmann/following{/other_user}","gists_url":"https://api.github.com/users/marcbachmann/gists{/gist_id}","starred_url":"https://api.github.com/users/marcbachmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcbachmann/subscriptions","organizations_url":"https://api.github.com/users/marcbachmann/orgs","repos_url":"https://api.github.com/users/marcbachmann/repos","events_url":"https://api.github.com/users/marcbachmann/events{/privacy}","received_events_url":"https://api.github.com/users/marcbachmann/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T19:50:15Z","updated_at":"2016-06-09T19:50:15Z","body":"Thanks for the pr & test. There's one small thing to fix in here.\r\n`error` and `exit` event can get triggered together. So we'll need to prevent that the callback gets called twice.\r\n\r\n```js\r\nvar callbacked = false\r\nfunction exit (err, data) {\r\n  if (callbacked) return\r\n  callbacked = true\r\n  clearTimeout(timeout)\r\n  if (err) return callback(err)\r\n  callback(null, data)\r\n}\r\n\r\nchild.on('error', exit)\r\nchild.on('exit', function (code) {\r\n    if (code || stderr.length) {\r\n      var err = new Error(Buffer.concat(stderr).toString() || 'html-pdf: Unknown Error')\r\n      return exit(err)\r\n    } else {\r\n      ...\r\n      exit(null, data)\r\n    }\r\n})\r\n\r\n```"}}
{"actor":{"display_login":"marcbachmann"}}