Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.promises.readFile cannot read /proc/stat, produces empty result #21331

Closed
constb opened this issue Jun 14, 2018 · 2 comments
Closed

fs.promises.readFile cannot read /proc/stat, produces empty result #21331

constb opened this issue Jun 14, 2018 · 2 comments
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system.

Comments

@constb
Copy link

constb commented Jun 14, 2018

  • Version: 10.4.1
  • Platform: Amazon Linux 2, kernel 4.14 x64
  • Subsystem: fs, experimental promises api
const fs = require('fs')
fs.promises.readFile('/proc/stat', { encoding: 'utf8' }).then(r => console.log(r.length)) // => 0
fs.readFile('/proc/stat', { encoding: 'utf8' }, (e, r) => console.log(r.length)) // => 2347
console.log(fs.readFileSync('/proc/stat', { encoding: 'utf8' }).length) // => 2347

I'm not sure how promises API differs from classic one, but this behaviour is surprising, and I can't find anything in the docs that would explain what I am doing wrong…

@fanyer
Copy link

fanyer commented Jun 21, 2018

same with me, the fs.promises interface return 0 when readFile /proc/stat .

  • Version: 10.4.1
  • Platform: Debian 9.4 linux 4.9.0.6 x64

@TimothyGu TimothyGu added confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. labels Jun 24, 2018
@TimothyGu
Copy link
Member

Can reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

3 participants