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

Fix piping to commands by letting process exit naturally #41

Merged
merged 1 commit into from
Oct 5, 2018

Conversation

mmalecki
Copy link
Contributor

@mmalecki mmalecki commented Oct 4, 2018

Node.js' process.stdout is asynchronous when connected to a
pipe
,
so forcing an earlier process.exit() results in incomplete data being
output to the pipe.

This fixes usecases like cfcli ls -f json | json.

[Node.js' `process.stdout` is asynchronous when connected to a
pipe](https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io),
so forcing an earlier `process.exit()` results in incomplete data being
output to the pipe.

This fixes usecases like `cfcli ls -f json | json`.
@danielpigott danielpigott merged commit 5c05f90 into danielpigott:master Oct 5, 2018
@danielpigott
Copy link
Owner

Thanks @mmalecki I have published this as v3.2.1

@mmalecki mmalecki deleted the fix-piping branch October 5, 2018 10:25
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.

2 participants