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

Redirecting file to stdin results in TypeError #3

Open
kevinoid opened this issue Feb 23, 2016 · 0 comments
Open

Redirecting file to stdin results in TypeError #3

kevinoid opened this issue Feb 23, 2016 · 0 comments

Comments

@kevinoid
Copy link

[Note: This is the first of several issues. I'm happy to send PRs for some/all of these, but most need some discussion first.]

When running cat with stdin redirected from a file yields the following result:

$ ./bin/cat < ./index.js 
/tmp/posix-cat/bin/cat:9
cat.on('end', process.stdin.end.bind(process.stdin))
                               ^

TypeError: Cannot read property 'bind' of undefined
    at Object.<anonymous> (/media/linuxdata/kevin/tmp/posix-cat/bin/cat:9:32)
    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)
    at startup (node.js:134:18)
    at node.js:962:3

This is because process.stdin is tty.ReadStream when stdin is a TTY and fs.ReadStream when it is a file.

Do you recall the reason for calling .end() here?

Thanks,
Kevin

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

No branches or pull requests

1 participant