aboutsummaryrefslogtreecommitdiffstats
path: root/src/run/builtin.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/run/builtin.rs')
-rw-r--r--src/run/builtin.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/run/builtin.rs b/src/run/builtin.rs
index 0f90e51..da6f4f2 100644
--- a/src/run/builtin.rs
+++ b/src/run/builtin.rs
@@ -43,9 +43,13 @@ impl Builtin for re {
session.raw.disable();
match Command::new("cargo").arg("build").status() {
Ok(status) if status.success() => {
- let _ = Command::new("cargo").arg("run").status();
- session.raw.disable();
- std::process::exit(0);
+ // build of new shell succeeded
+
+ // unwind the entire stack intentionally to free resources
+ // the catch handler will check the boolean and execve into
+ // the new executable
+ super::RELOAD.store(true, std::sync::atomic::Ordering::SeqCst);
+ std::panic::resume_unwind(Box::new(42));
}
_ => (),
}