summaryrefslogtreecommitdiff
path: root/lib/hyperstack/cli.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 12:21:28 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 12:21:28 +0300
commit11dc2f6956d17142238656fe839dc6298125f5d9 (patch)
tree7d986ebf7bb877da4964261659f867a472b073b6 /lib/hyperstack/cli.rb
parentec691c42320a99118d9ece023ed5c497b13ae027 (diff)
fix(cli): synchronize access to errors hash in run_create_both
Diffstat (limited to 'lib/hyperstack/cli.rb')
-rw-r--r--lib/hyperstack/cli.rb5
1 files changed, 3 insertions, 2 deletions
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)