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

allow to read longer files from stdin #364

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anentropic
Copy link

Trying to read large blueprints from stdin fails, giving a syntax error which suggests the content was truncated. Reading the same file in via -i <filename> method works fine, so there is no issue with the file itself.

The length of the content I got was always 65536 bytes, suggesting some issue around buffering.

After experimenting it turns out that what actually happens is the process.stdin.on 'readable' event handler gets called multiple times for large files - for each block of data from the buffer.

So the fix is to build up the blueprint content over a series of readable events and wait until the end event is triggered before trying to process it.

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

Successfully merging this pull request may close these issues.

1 participant