Skip to content

Commit

Permalink
Return error when transformer fails.
Browse files Browse the repository at this point in the history
Previously, nonzero exit codes slipped through the cracks, ultimately
resulting in empty files being added to the index. Make `yact` return a
TransformerError when this occurs.
  • Loading branch information
NelsonAPenn committed Sep 2, 2024
1 parent 3a70b53 commit 058a159
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ pub mod transformer {
.write_all(clone.as_slice())
.expect("Failed to write to stream");
});
let stdout = child
let output = child
.wait_with_output()
.map_err(|_| "Failed to read stdout")?
.stdout;
Ok(stdout)
.map_err(|_| "Failed to wait on transformer process")?;

if !output.status.success() {
return Err("Transformer process produced nonzero exit code.".to_string());
}
Ok(output.stdout)
}
}

Expand Down

0 comments on commit 058a159

Please sign in to comment.