Skip to content

Commit a41a8ae

Browse files
authored
fix: Revert "fix(logs): create log files for non-cached tasks" (#11072)
Reverts #10806
1 parent 4e01393 commit a41a8ae

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

crates/turborepo-lib/src/run/cache.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,9 @@ impl TaskCache {
196196
pub fn output_writer<W: Write>(&self, writer: W) -> Result<LogWriter<W>, Error> {
197197
let mut log_writer = LogWriter::default();
198198

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

204203
match self.task_output_logs {
205204
OutputLogsMode::None | OutputLogsMode::HashOnly | OutputLogsMode::ErrorsOnly => {}

crates/turborepo-process/src/child.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -582,18 +582,9 @@ impl Child {
582582

583583
let writer_fut = async {
584584
let mut result = Ok(());
585-
loop {
586-
match tokio::time::timeout(Duration::from_millis(200), byte_rx.recv()).await {
587-
Ok(Some(bytes)) => {
588-
result = stdout_pipe.write_all(&bytes);
589-
}
590-
Ok(None) => break,
591-
Err(_) => {
592-
// Flush the writer periodically if there hasn't been any new output
593-
result = stdout_pipe.flush();
594-
}
595-
}
596-
if result.is_err() {
585+
while let Some(bytes) = byte_rx.recv().await {
586+
if let Err(err) = stdout_pipe.write_all(&bytes) {
587+
result = Err(err);
597588
break;
598589
}
599590
}

crates/turborepo-ui/src/logs.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ impl<W: Write> LogWriter<W> {
3838
Error::CannotWriteLogs(err)
3939
})?;
4040

41-
// We keep the buffer smaller to ensure the log file does not too far behind the
42-
// displayed logs.
43-
self.log_file = Some(BufWriter::with_capacity(512, log_file));
41+
self.log_file = Some(BufWriter::new(log_file));
4442

4543
Ok(())
4644
}

0 commit comments

Comments
 (0)