-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
Drain stdout pipe while command is running #614
Conversation
@f-meloni Could you review this when you have a chance? |
|
||
let data = pipe.fileHandleForReading.readDataToEndOfFile() | ||
|
||
task.waitUntilExit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you still receive all the text output coming from the executed shell command after this change?
Given we are reading before the task ends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're calling readDataToEndOfFile()
so we'll get the entire output of the command from the pipe before continuing to task.waitUntilExit()
, which I assume will basically immediately complete at that point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@f-meloni does that seem correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give it a chance :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind please updating the Changelog before merging? Thank you
One of the commands we called as part of a Danger plugin ended up generating more output that the
Pipe
's buffer could hold. This resulted in Danger locking up and blocking CI.This change moves reading from stdin to before the task has exited so that the
Pipe
does not get too full.You can test this change will the following code:
I thought about adding a test, but if the test were to ever go wrong it would lock up CI instead of failing