GithubHelp home page GithubHelp logo

gpestana / pipe-args Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 2.0 28 KB

POSIX compliant pipe argument parser for node CLI apps

License: MIT License

JavaScript 100.00%
unix-like unix-pipes nodejs posix

pipe-args's Issues

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

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

Unhandled exception (Error: EAGAIN: resource temporarily unavailable, read)

In some cases there is an unhandled EAGAIN exception being thrown. This seems to happen when there is no data in /dev/stdin. I'd expect this to happen only when in async mode though.

Error: EAGAIN: resource temporarily unavailable, read
    at Error (native)
    at Object.fs.readSync (fs.js:603:19)
    at Object.fs.readFileSync (fs.js:438:24)
    at /Users/home/dev/js-ipfs/node_modules/pipe-args/index.js:7:31
    at Object.<anonymous> (/Users/home/dev/js-ipfs/node_modules/pipe-args/index.js:9:3)
    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 Module.require (module.js:353:17)

feat: Copy stdin to process.argv only in certain cases

In some cases, there might be the need to restrict in which situations the stdin is parsed into process.argv. E.g. Copy piped argument to process.argv only If the CLI command is one of {X,Y,Z}, otherwise ignore it.

For the 1st iteration, we can assume that the command can be read from process.argv[2].

Does not work with big content.

I started out using this package for getting a piped argument.
However, it doesn't seem to work with big content.
At that point I switched to get-stdin which does work with bigger content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.