Skip to content

Commit

Permalink
Reordering errors on job failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbor committed Jul 20, 2024
1 parent 4857a28 commit 6fcb244
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,24 +254,23 @@ impl InnerJobRealization {
process
};

let out_lines = out_lines.into_iter().rev().collect();

let status = process.wait()?;
if !status.success() {
match status.code() {
Some(code) => return Err(ZinnError::ChildFailed(code, out_lines)),
None => return Err(ZinnError::ChildSignaled()),
}
}

for file in &self.outputs {
if !Path::new(file).exists() {
return Err(ZinnError::OutputFileError(file.to_owned()));
}
}

let out_lines = out_lines.into_iter().rev().collect();

if !status.success() {
match status.code() {
Some(code) => Err(ZinnError::ChildFailed(code, out_lines)),
None => Err(ZinnError::ChildSignaled()),
}
} else {
Ok(JobState::Finished)
}
Ok(JobState::Finished)
}

fn check_input_files(&self) -> ZinnResult<()> {
Expand Down

0 comments on commit 6fcb244

Please sign in to comment.