remove output file on error
This commit is contained in:
parent
eb99ba7119
commit
ea09723455
|
@ -61,7 +61,10 @@ pub fn run(path: &str, outfile: &str) -> Result<()> {
|
|||
|
||||
bp::Writer::new()
|
||||
.parse_tree(&node_tree)
|
||||
.map_err(Error::BpError)?
|
||||
.or_else(|e| {
|
||||
std::fs::remove_file(outfile).map_err(Error::BadWrite)?;
|
||||
Err(Error::BpError(e))
|
||||
})?
|
||||
.write_to(&mut out)
|
||||
.map_err(Error::BadWrite)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue