summaryrefslogtreecommitdiff
path: root/lib/hyperstack
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hyperstack')
-rw-r--r--lib/hyperstack/ssh_runner.rb1
-rw-r--r--lib/hyperstack/state.rb7
-rw-r--r--lib/hyperstack/wireguard_setup.rb1
3 files changed, 9 insertions, 0 deletions
diff --git a/lib/hyperstack/ssh_runner.rb b/lib/hyperstack/ssh_runner.rb
index e4440b6..1384109 100644
--- a/lib/hyperstack/ssh_runner.rb
+++ b/lib/hyperstack/ssh_runner.rb
@@ -25,6 +25,7 @@ module HyperstackVM
combined << line
@out.print(line)
end
+ @out.flush
return [combined, wait_thr.value]
end
end
diff --git a/lib/hyperstack/state.rb b/lib/hyperstack/state.rb
index 0ce2687..a52b057 100644
--- a/lib/hyperstack/state.rb
+++ b/lib/hyperstack/state.rb
@@ -53,5 +53,12 @@ module HyperstackVM
@mutex.synchronize { @delegate.print("#{@prefix}#{line}") }
end
end
+
+ def flush
+ return if @buffer.empty?
+
+ @mutex.synchronize { @delegate.print("#{@prefix}#{@buffer}") }
+ @buffer = +''
+ end
end
end
diff --git a/lib/hyperstack/wireguard_setup.rb b/lib/hyperstack/wireguard_setup.rb
index 82a9dba..b2b7ec1 100644
--- a/lib/hyperstack/wireguard_setup.rb
+++ b/lib/hyperstack/wireguard_setup.rb
@@ -68,6 +68,7 @@ module HyperstackVM
stdin.puts
stdin.close
output.each { |line| @out.print(line) }
+ @out.flush
wait_thr.value
end
end