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

Error: ENXIO: no such device or address, open '/dev/stdin' #2

Closed
gpestana opened this issue Mar 12, 2017 · 1 comment
Closed

Error: ENXIO: no such device or address, open '/dev/stdin' #2

gpestana opened this issue Mar 12, 2017 · 1 comment
Labels

Comments

@gpestana
Copy link
Owner

ENXIO uncaught exception. This might be related with file descriptions being sockets and not pipes.

Error: ENXIO: no such device or address, open '/dev/stdin'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.module.exports.load (/home/travis/build/ipfs/js-ipfs/node_modules/pipe-args/index.js:10:27)
    at Object.<anonymous> (/home/travis/build/ipfs/js-ipfs/src/cli/bin.js:5:22)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)

  Error: Command failed: /home/travis/build/ipfs/js-ipfs/src/cli/bin.js object data QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm
  /home/travis/build/ipfs/js-ipfs/node_modules/pipe-args/index.js:13
      if (e.code != 'EAGAIN') throw e;

More info: https://travis-ci.org/ipfs/js-ipfs/jobs/210148607
Related: nodejs/node-v0.x-archive#3530

@gpestana gpestana added the bug label Mar 12, 2017
@gpestana
Copy link
Owner Author

readFileSync uses stat(2) to calculate the size of files to read. Since it is impossible to know beforehand the size of /dev/stdin, the exception with code ENXIO was thrown. Perhaps also the fact that stdin fd in node is abstracted as socket and not a pipe anymore. This makes it tricky to write sync code for it.
The solution was to use readSync and read through the contents of /dev/stdin, explicitly giving the buffer offsets, etc..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant