{"action":"created","issue":{"url":"https://api.github.com/repos/nodegit/promisify-node/issues/17","repository_url":"https://api.github.com/repos/nodegit/promisify-node","labels_url":"https://api.github.com/repos/nodegit/promisify-node/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/nodegit/promisify-node/issues/17/comments","events_url":"https://api.github.com/repos/nodegit/promisify-node/issues/17/events","html_url":"https://github.com/nodegit/promisify-node/issues/17","id":132563041,"number":17,"title":"Problem with fs.writeFile","user":{"login":"sstur","id":369384,"avatar_url":"https://avatars.githubusercontent.com/u/369384?v=3","gravatar_id":"","url":"https://api.github.com/users/sstur","html_url":"https://github.com/sstur","followers_url":"https://api.github.com/users/sstur/followers","following_url":"https://api.github.com/users/sstur/following{/other_user}","gists_url":"https://api.github.com/users/sstur/gists{/gist_id}","starred_url":"https://api.github.com/users/sstur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstur/subscriptions","organizations_url":"https://api.github.com/users/sstur/orgs","repos_url":"https://api.github.com/users/sstur/repos","events_url":"https://api.github.com/users/sstur/events{/privacy}","received_events_url":"https://api.github.com/users/sstur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-02-09T23:03:33Z","updated_at":"2016-08-14T04:35:50Z","closed_at":null,"body":"This appears to be caused by the fact that `fs` module is mutated by `promisify('fs')`. Internally, `fs.writeFile` uses some other `fs` methods in a callback fashion, so it expects `fs` to be un-modified.\r\n\r\nRepro:\r\n\r\n    const promisify = require('promisify-node');\r\n    const fs = promisify('fs');\r\n    fs.writeFile('./testfile.txt', 'Hello World')\r\n      .then(() => {\r\n        console.log('File saved!');\r\n      })\r\n      .catch((error) => {\r\n        console.error('Error doing something:', error);\r\n      });\r\n    \r\nNeither 'File saved!' or 'Error doing something' ever gets logged. The file gets created but no data is written to it. Tested on OS X 10.11 using Node v5."},"comment":{"url":"https://api.github.com/repos/nodegit/promisify-node/issues/comments/239655780","html_url":"https://github.com/nodegit/promisify-node/issues/17#issuecomment-239655780","issue_url":"https://api.github.com/repos/nodegit/promisify-node/issues/17","id":239655780,"user":{"login":"binki","id":82626,"avatar_url":"https://avatars.githubusercontent.com/u/82626?v=3","gravatar_id":"","url":"https://api.github.com/users/binki","html_url":"https://github.com/binki","followers_url":"https://api.github.com/users/binki/followers","following_url":"https://api.github.com/users/binki/following{/other_user}","gists_url":"https://api.github.com/users/binki/gists{/gist_id}","starred_url":"https://api.github.com/users/binki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binki/subscriptions","organizations_url":"https://api.github.com/users/binki/orgs","repos_url":"https://api.github.com/users/binki/repos","events_url":"https://api.github.com/users/binki/events{/privacy}","received_events_url":"https://api.github.com/users/binki/received_events","type":"User","site_admin":false},"created_at":"2016-08-14T04:35:50Z","updated_at":"2016-08-14T04:35:50Z","body":"I get this too:\r\n\r\n```\r\nohnobinki@gibby ~/require-semver $ node -e 'require(\"fs\").writeFile(\"a\", \"b\\n\", () => console.log(\"done\"))'; cat a\r\ndone\r\nb\r\nohnobinki@gibby ~/require-semver $ node -e 'require(\"promisify-node\")(require(\"fs\")).writeFile(\"a\", \"b\\n\").then(() => console.log(\"done\"))'; cat a\r\nohnobinki@gibby ~/require-semver $ \r\n```\r\n"}}
{"actor":{"display_login":"binki"}}