Skip to content

Commit adfb83f

Browse files
authored
fix: Audit 03/03 (#1852)
* Fix stream capture. * Fix system. * Polish. * Bump. * Fixes. * Fixes.
1 parent b71c548 commit adfb83f

6 files changed

Lines changed: 45 additions & 17 deletions

File tree

.yarn/versions/f44763e4.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
releases:
2+
"@moonrepo/cli": patch
3+
"@moonrepo/core-linux-arm64-gnu": patch
4+
"@moonrepo/core-linux-arm64-musl": patch
5+
"@moonrepo/core-linux-x64-gnu": patch
6+
"@moonrepo/core-linux-x64-musl": patch
7+
"@moonrepo/core-macos-arm64": patch
8+
"@moonrepo/core-macos-x64": patch
9+
"@moonrepo/core-windows-x64-msvc": patch

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
#### 🐞 Fixes
6+
7+
- Fixed an issue where task output wasn't captured for the "review" section in a run summary.
8+
- Fixed an issue where a task with a `script` would always be forced to the "system" toolchain.
9+
310
## 1.32.7
411

512
#### 🚀 Updates

crates/console-reporter/src/default_reporter.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,6 @@ impl DefaultReporter {
161161
continue;
162162
}
163163

164-
if let Some(attempt) = action.operations.get_last_execution() {
165-
if attempt.has_failed() {
166-
self.print_operation_output(attempt, &TaskReportItem::default())?;
167-
}
168-
}
169-
170164
self.out.print_checkpoint(
171165
Checkpoint::RunFailed,
172166
match &*action.node {
@@ -175,6 +169,16 @@ impl DefaultReporter {
175169
},
176170
)?;
177171

172+
if let Some(attempt) = action.operations.get_last_execution() {
173+
if attempt.has_failed() {
174+
self.print_operation_output(attempt, &TaskReportItem::default())?;
175+
}
176+
}
177+
178+
// Force flush so the output is rendered in the correct order
179+
self.out.flush()?;
180+
self.err.flush()?;
181+
178182
self.out.write_newline()?;
179183
}
180184

crates/task-builder/src/tasks_builder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ impl<'proj> TasksBuilder<'proj> {
441441
// If a script, wipe out inherited arguments, and extract the first command
442442
if let Some(script) = &task.script {
443443
task.args.clear();
444-
task.toolchains = vec![Id::raw("system")];
444+
445+
if task.toolchains.is_empty() {
446+
task.toolchains.push(Id::raw("system"));
447+
}
445448

446449
if let Some(i) = script.find(' ') {
447450
task.command = script[0..i].to_owned();

crates/task-runner/src/command_executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ impl<'task> CommandExecutor<'task> {
113113
interactive: bool,
114114
) -> miette::Result<Output> {
115115
match (stream, interactive) {
116-
(true, true) | (false, true) => command.exec_stream_output().await,
117-
(true, false) => command.exec_stream_and_capture_output().await,
116+
(true, false) | (true, true) => command.exec_stream_and_capture_output().await,
117+
(false, true) => command.exec_stream_output().await,
118118
_ => command.exec_capture_output().await,
119119
}
120120
}

legacy/rust/platform/src/rust_platform.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,9 @@ impl Platform for RustPlatform {
401401
);
402402
}
403403

404-
if !self.config.bins.is_empty() {
405-
let globals_dir = self.get_globals_dir(Some(tool));
404+
let globals_dir = self.get_globals_dir(Some(tool));
406405

406+
if !self.config.bins.is_empty() {
407407
// Install cargo-binstall if it does not exist
408408
if !globals_dir.join(exe_name("cargo-binstall")).exists() {
409409
debug!(
@@ -436,28 +436,33 @@ impl Platform for RustPlatform {
436436

437437
for bin in &self.config.bins {
438438
let mut args = vec!["binstall", "--no-confirm", "--log-level", "info"];
439-
440-
match bin {
441-
BinEntry::Name(name) => args.push(name),
439+
let name = match bin {
440+
BinEntry::Name(inner) => {
441+
args.push(inner);
442+
inner
443+
}
442444
BinEntry::Config(cfg) => {
443445
if cfg.local && is_ci() {
444446
continue;
445447
}
446448

447449
if cfg.force {
448450
args.push("--force");
451+
// force = cfg.force;
449452
}
450453

451454
args.push(&cfg.bin);
455+
&cfg.bin
452456
}
453457
};
454458

455459
operations.push(
456460
Operation::task_execution(format!("cargo {}", args.join(" ")))
457461
.track_async(|| async {
458-
self.console
459-
.out
460-
.print_checkpoint(Checkpoint::Setup, "cargo binstall")?;
462+
self.console.out.print_checkpoint(
463+
Checkpoint::Setup,
464+
format!("cargo binstall {name}"),
465+
)?;
461466

462467
tool.exec_cargo(args, working_dir).await
463468
})

0 commit comments

Comments
 (0)