Skip to content

Commit 427b43c

Browse files
wan9chicodex
andcommitted
fix: clarify task output forwarding errors
Co-authored-by: GPT-5.6 Codex <codex@openai.com>
1 parent aa2ef96 commit 427b43c

4 files changed

Lines changed: 38 additions & 2 deletions

File tree

CHANGELOG.md

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

3+
- **Fixed** Failures while forwarding output from a started task process no longer incorrectly say the process failed to spawn ([#506](https://github.com/voidzero-dev/vite-task/issues/506)).
34
- **Fixed** An issue where Bun tasks on macOS did not rerun when files they read, wrote, or listed changed ([#532](https://github.com/voidzero-dev/vite-task/issues/532), [#542](https://github.com/voidzero-dev/vite-task/pull/542)).
45
- **Improved** Windows file-access tracking now uses sparse temporary backing files where supported, avoiding upfront allocation of the full backing file on disk ([#524](https://github.com/voidzero-dev/vite-task/pull/524)).
56
- **Fixed** Automatic file-access tracking on Linux now works in containers and Kubernetes runners with limited `/dev/shm` space ([#353](https://github.com/voidzero-dev/vite-task/issues/353), [#523](https://github.com/voidzero-dev/vite-task/pull/523)).

crates/vite_task/src/session/event.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ pub enum ExecutionError {
4141
#[error("Failed to spawn process")]
4242
Spawn(#[source] anyhow::Error),
4343

44+
/// The child process started, but the runner failed while forwarding its output.
45+
#[error("Failed to forward task process output")]
46+
ForwardTaskProcessOutput(#[source] anyhow::Error),
47+
4448
/// The child process started, but the runner failed while waiting for it to exit.
4549
#[error("Failed to wait for task process to exit")]
4650
WaitForTaskProcessExit(#[source] anyhow::Error),

crates/vite_task/src/session/execute/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ async fn run_child(
598598
reason = "pipe_stdio streams child I/O and creates a large future"
599599
)]
600600
let r = pipe_stdio(stdout, stderr, sinks, fast_fail_token.clone()).await;
601-
r.map_err(|err| ExecutionError::Spawn(err.into()))
601+
r.map_err(|err| ExecutionError::ForwardTaskProcessOutput(err.into()))
602602
} else {
603603
Ok(())
604604
};

crates/vite_task/src/session/reporter/summary.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub enum SpawnOutcome {
121121
/// No `infra_error` field: cache operations are skipped on non-zero exit.
122122
Failed { exit_code: NonZeroI32 },
123123

124-
/// Could not start the process (e.g., command not found).
124+
/// Execution failed without a usable process exit status.
125125
SpawnError(SavedExecutionError),
126126
}
127127

@@ -152,6 +152,7 @@ pub enum SavedCacheMissReason {
152152
pub enum SavedExecutionError {
153153
Cache { kind: SavedCacheErrorKind, message: Str },
154154
Spawn { message: Str },
155+
ForwardTaskProcessOutput { message: Str },
155156
WaitForTaskProcessExit { message: Str },
156157
PostRunFingerprint { message: Str },
157158
IpcServerBind { message: Str },
@@ -239,6 +240,9 @@ impl SavedExecutionError {
239240
ExecutionError::Spawn(source) => {
240241
Self::Spawn { message: vite_str::format!("{source:#}") }
241242
}
243+
ExecutionError::ForwardTaskProcessOutput(source) => {
244+
Self::ForwardTaskProcessOutput { message: vite_str::format!("{source:#}") }
245+
}
242246
ExecutionError::WaitForTaskProcessExit(source) => {
243247
Self::WaitForTaskProcessExit { message: vite_str::format!("{source:#}") }
244248
}
@@ -264,6 +268,9 @@ impl SavedExecutionError {
264268
Self::Spawn { message } => {
265269
vite_str::format!("Failed to spawn process: {message}")
266270
}
271+
Self::ForwardTaskProcessOutput { message } => {
272+
vite_str::format!("Failed to forward task process output: {message}")
273+
}
267274
Self::WaitForTaskProcessExit { message } => {
268275
vite_str::format!("Failed to wait for task process to exit: {message}")
269276
}
@@ -916,3 +923,27 @@ fn format_input_modified_notice(buf: &mut Vec<u8>, task_names: &[Str]) {
916923
let _ = write!(buf, " not cached because they modified their inputs.");
917924
}
918925
}
926+
927+
#[cfg(test)]
928+
mod tests {
929+
use super::*;
930+
931+
#[test]
932+
fn output_forwarding_error_has_distinct_message() {
933+
let error = ExecutionError::ForwardTaskProcessOutput(anyhow::anyhow!(
934+
"Resource temporarily unavailable (os error 11)"
935+
));
936+
937+
let saved = SavedExecutionError::from_execution_error(&error);
938+
939+
assert!(matches!(
940+
&saved,
941+
SavedExecutionError::ForwardTaskProcessOutput { message }
942+
if message.as_str() == "Resource temporarily unavailable (os error 11)"
943+
));
944+
assert_eq!(
945+
saved.display_message().as_str(),
946+
"Failed to forward task process output: Resource temporarily unavailable (os error 11)"
947+
);
948+
}
949+
}

0 commit comments

Comments
 (0)