aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonas Maier <jonas@x77.dev>2026-03-15 21:00:25 +0100
committerJonas Maier <jonas@x77.dev>2026-03-15 21:00:25 +0100
commit07d4def3eff0b8ffb6b962859b61a3da62d124f0 (patch)
treee6bd27321897345c00dc290a1218efcb75db082d /src
parent3f9b1be9b984bd5674f251d7ce4977f2a4607dac (diff)
downloadpish-07d4def3eff0b8ffb6b962859b61a3da62d124f0.tar.gz
redefining functions without cli error
Diffstat (limited to 'src')
-rw-r--r--src/export_fun.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/export_fun.rs b/src/export_fun.rs
index d8722b4..64810eb 100644
--- a/src/export_fun.rs
+++ b/src/export_fun.rs
@@ -355,7 +355,13 @@ fn create_function_hook_res(
let sock_run = session.socket_running.as_ref().ok_or("no socket running")?;
let exe_path = current_exe()?;
let symlink_path = sock_run.bin_path.join(OsStr::from_bytes(fun_name));
- symlink(exe_path, symlink_path)?;
+ if let Err(e) = symlink(exe_path, symlink_path) {
+ match e.kind() {
+ // this is expected to happen when functions get redefined
+ io::ErrorKind::AlreadyExists => (),
+ _ => return Err(e)?,
+ }
+ }
Ok(())
}