turbo
0a3bf270 - feat: ensure PrefixedWriter is line buffered (#7728)

Commit
1 year ago
feat: ensure PrefixedWriter is line buffered (#7728) ### Description At the moment, it is currently the caller's responsibility to make sure that `PrefixedWriter` is only fed a single line at a time and that writes end with a newline. If the caller doesn't do this output can be unexpected such as: ``` prefix > one two three ``` or ``` prefix1 > no newline prefix2 > my log line ``` We currently call this correctly since we read child output in a [line buffered manner](https://github.com/vercel/turbo/blob/main/crates/turborepo-lib/src/process/child.rs#L614) and [inserting newlines if they're missing](https://github.com/vercel/turbo/blob/main/crates/turborepo-lib/src/process/child.rs#L636). With the move to richer output such as spinners we will no longer be waiting to see a newline to forward output. This PR prepares us for that future by making `PrefixedWriter` itself a line buffered writer so callers will no longer need to worry about this. ### Testing Instructions Added unit tests for verifying that callers who write `PrefixedWriter` no longer need to ensure they write full lines. Closes TURBO-2634
Parents
Loading