Skip to content

Instantly share code, notes, and snippets.

@chantra
Last active January 25, 2024 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chantra/c09534363519d429018b095dcbb18cdd to your computer and use it in GitHub Desktop.
Save chantra/c09534363519d429018b095dcbb18cdd to your computer and use it in GitHub Desktop.
commit 7f655a473c64a80094f94e06541a8ab25a218643
Author: Manu Bretelle <chantr4@gmail.com>
Date: Tue Jan 16 22:56:29 2024 -0800
run_command: wait for command to run indefinitely
Signed-off-by: Manu Bretelle <chantr4@gmail.com>
diff --git a/src/qemu.rs b/src/qemu.rs
index 83b9132..671e17c 100644
--- a/src/qemu.rs
+++ b/src/qemu.rs
@@ -747,6 +747,8 @@ impl Qemu {
let _ = updates.send(Output::Command(line));
};
+ qga.set_read_timeout(None)?;
+
let output_stream = self
.connect_to_uds(&self.command_sock)
.context("Failed to connect to command output socket")?;
diff --git a/src/qga.rs b/src/qga.rs
index 526e004..ba30a69 100644
--- a/src/qga.rs
+++ b/src/qga.rs
@@ -99,6 +99,11 @@ impl QgaWrapper {
bail!("Timed out waiting for QGA connection");
}
+ pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<()> {
+ self.stream.set_read_timeout(timeout)?;
+ Ok(())
+ }
+
/// Run a command inside the guest
pub fn guest_exec(
&self,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment