Spike: fs/upgrade/bench examples, agent resumes interrupted turns, world lock, short trap reasons
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user