Use random session ID instead of PID
change xnsylwuyzztxznzutqkxsyymqzwtusno
commit cd2cf4826929f537bb099b406836994d5901a229
author Alpha Chen <alpha@kejadlen.dev>
date
parent mrtlyxuw
diff --git a/Cargo.lock b/Cargo.lock
index 85e2b9b..45c7667 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -588,6 +588,7 @@ version = "0.1.0"
 dependencies = [
  "clap",
  "color-eyre",
+ "fastrand",
  "fs-err",
  "serde",
  "serde-kdl2",
diff --git a/Cargo.toml b/Cargo.toml
index a1ddf2c..0670a49 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,7 @@ edition = "2024"
 [dependencies]
 clap = { version = "*", features = ["derive"] }
 color-eyre = "*"
+fastrand = "*"
 fs-err = "*"
 serde = { version = "*", features = ["derive"] }
 # Pinned to prerelease — alpha.4 fixes serde defaults with bare KDL values.
diff --git a/src/main.rs b/src/main.rs
index 0cda89c..7748498 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -308,9 +308,9 @@ impl Ramekin {
 // Helpers
 // ---------------------------------------------------------------------------
 
-/// Generate a short random session ID.
+/// Generate a session ID from the current process ID.
 fn session_id() -> String {
-    format!("{:x}", std::process::id())
+    format!("{:08x}", fastrand::u32(..))
 }
 
 /// Create a slug for a workspace path: `<dirname>-<hash>`.