From 11dc2f6956d17142238656fe839dc6298125f5d9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 12:21:28 +0300 Subject: fix(cli): synchronize access to errors hash in run_create_both --- lib/hyperstack/cli.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/hyperstack/cli.rb') diff --git a/lib/hyperstack/cli.rb b/lib/hyperstack/cli.rb index 207df83..479f1c3 100644 --- a/lib/hyperstack/cli.rb +++ b/lib/hyperstack/cli.rb @@ -291,13 +291,14 @@ module HyperstackVM wg_setup_pre: vm2_wg_pre) errors = {} + errors_mutex = Mutex.new create_opts = { replace: replace, dry_run: dry_run, install_vllm: install_vllm, install_ollama: install_ollama, install_comfyui: install_comfyui } vm1_thread = Thread.new do manager1.create(**create_opts) rescue Error => e - errors[:vm1] = e.message + errors_mutex.synchronize { errors[:vm1] = e.message } # Unblock VM2 even if VM1 failed so the process doesn't hang. wg_mutex.synchronize do vm1_wg_state[:error] = e.message @@ -308,7 +309,7 @@ module HyperstackVM vm2_thread = Thread.new do manager2.create(**create_opts) rescue Error => e - errors[:vm2] = e.message + errors_mutex.synchronize { errors[:vm2] = e.message } end [vm1_thread, vm2_thread].each(&:join) -- cgit v1.2.3