Skip to content

Commit 9fe891a

Browse files
authored
fix(chisel): on edit fail command only if execution failed (foundry-rs#9155)
1 parent b1e9365 commit 9fe891a

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

crates/chisel/src/dispatcher.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -719,18 +719,20 @@ impl ChiselDispatcher {
719719
}
720720
}
721721

722-
// If the contract execution failed, continue on without
723-
// updating the source.
724-
DispatchResult::CommandFailed(Self::make_error(
725-
"Failed to execute edited contract!",
726-
))
727-
} else {
728-
// the code could be compiled, save it
729-
*self.source_mut() = new_session_source;
730-
DispatchResult::CommandSuccess(Some(String::from(
731-
"Successfully edited `run()` function's body!",
732-
)))
722+
if failed {
723+
// If the contract execution failed, continue on without
724+
// updating the source.
725+
return DispatchResult::CommandFailed(Self::make_error(
726+
"Failed to execute edited contract!",
727+
));
728+
}
733729
}
730+
731+
// the code could be compiled, save it
732+
*self.source_mut() = new_session_source;
733+
DispatchResult::CommandSuccess(Some(String::from(
734+
"Successfully edited `run()` function's body!",
735+
)))
734736
}
735737
Err(_) => {
736738
DispatchResult::CommandFailed("The code could not be compiled".to_string())

0 commit comments

Comments
 (0)