Spike: fs/upgrade/bench examples, agent resumes interrupted turns, world lock, short trap reasons

This commit is contained in:
2026-10-15 05:00:33 +01:00
parent 83bbbb33a8
commit 0be152dda9
13 changed files with 293 additions and 8 deletions
+6
View File
@@ -147,6 +147,11 @@ async fn run(dir: PathBuf) -> Result<()> {
if !world.exists() {
bail!("{} is not a Sausage world. Create one with: sausage init {}", dir.display(), dir.display());
}
// One host process per world.
let lock = std::fs::File::create(world.root.join(".lock"))?;
if lock.try_lock().is_err() {
bail!("another sausage process runs {}", dir.display());
}
let runtime = runtime::Runtime::new()?;
let broker = Broker::new(world.clone(), runtime)?;
@@ -165,6 +170,7 @@ async fn run(dir: PathBuf) -> Result<()> {
console.run_input().await;
println!("Stopping actors …");
broker.shutdown_all().await;
drop(lock);
Ok(())
}