这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions crates/turborepo-lib/src/run/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,10 @@ impl TaskCache {
pub fn output_writer<W: Write>(&self, writer: W) -> Result<LogWriter<W>, Error> {
let mut log_writer = LogWriter::default();

if !self.caching_disabled && !self.run_cache.writes_disabled {
log_writer.with_log_file(&self.log_file_path)?;
}
// We always write a log file even if we do not cache it. This would
// allow users to "stream" specific logs from a single task if the TUI
// was being used.
log_writer.with_log_file(&self.log_file_path)?;

match self.task_output_logs {
OutputLogsMode::None | OutputLogsMode::HashOnly | OutputLogsMode::ErrorsOnly => {}
Expand Down
15 changes: 12 additions & 3 deletions crates/turborepo-process/src/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,18 @@ impl Child {

let writer_fut = async {
let mut result = Ok(());
while let Some(bytes) = byte_rx.recv().await {
if let Err(err) = stdout_pipe.write_all(&bytes) {
result = Err(err);
loop {
match tokio::time::timeout(Duration::from_millis(200), byte_rx.recv()).await {
Ok(Some(bytes)) => {
result = stdout_pipe.write_all(&bytes);
}
Ok(None) => break,
Err(_) => {
// Flush the writer periodically if there hasn't been any new output
result = stdout_pipe.flush();
}
}
if result.is_err() {
break;
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/turborepo-ui/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ impl<W: Write> LogWriter<W> {
Error::CannotWriteLogs(err)
})?;

self.log_file = Some(BufWriter::new(log_file));
// We keep the buffer smaller to ensure the log file does not too far behind the
// displayed logs.
self.log_file = Some(BufWriter::with_capacity(512, log_file));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default is 8KB which might take awhile to fill up depending on the underlying task.


Ok(())
}
Expand Down
Loading