Skip to content

Conversation

@BolajiOlajide
Copy link
Contributor

Test plan

I added a unit test for this.

@BolajiOlajide BolajiOlajide self-assigned this Jan 12, 2023
@BolajiOlajide BolajiOlajide requested a review from a team January 12, 2023 23:23
prefix string
}

func (w *prefixedWriter) Write(p []byte) (int, error) {
Copy link
Member

@eseliger eseliger Jan 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked the source of p and I think we will only ever stream 1 line at a time, either with the newline at the end, or not if the stream has ended and there is no newline (for example echo -n).
So that makes me think that we shouldn't even split the p in here at all - and would as a side-effect get that for free, while retaining actual empty log lines. How does that feel for you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Yeah true - that's better. I can just remove the loop then. It makes sense to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just re-validate that - but from reading code it seems like our scanner on the other end of this stream would write in line-chunks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I just tested it, and it works. For both SSBC and local executions - the log output is consistent now.
Pushed a refactor.

@BolajiOlajide BolajiOlajide force-pushed the bo/fix-duplicate-log-output branch from a14db80 to 20ef19c Compare January 13, 2023 00:17
Copy link
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

@BolajiOlajide BolajiOlajide merged commit c84c80a into main Jan 13, 2023
@BolajiOlajide BolajiOlajide deleted the bo/fix-duplicate-log-output branch January 13, 2023 13:12
scjohns pushed a commit that referenced this pull request Apr 24, 2023
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.

3 participants