[pve-devel] [PATCH installer 2/7] tui: install progress: split out low-level installer spawing into own function
Christoph Heiss
c.heiss at proxmox.com
Wed Jul 26 16:03:56 CEST 2023
No functional changes.
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
.../src/views/install_progress.rs | 46 +++++++++----------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/proxmox-tui-installer/src/views/install_progress.rs b/proxmox-tui-installer/src/views/install_progress.rs
index e9d764a..870c6a3 100644
--- a/proxmox-tui-installer/src/views/install_progress.rs
+++ b/proxmox-tui-installer/src/views/install_progress.rs
@@ -58,35 +58,35 @@ impl InstallProgressView {
}
}
+fn spawn_low_level_installer() -> io::Result<process::Child> {
+ use std::process::{Command, Stdio};
+
+ #[cfg(not(debug_assertions))]
+ let (path, args, envs): (&str, [&str; 1], [(&str, &str); 0]) =
+ ("proxmox-low-level-installer", ["start-session"], []);
+
+ #[cfg(debug_assertions)]
+ let (path, args, envs) = (
+ std::path::PathBuf::from("./proxmox-low-level-installer"),
+ ["-t", "start-session-test"],
+ [("PERL5LIB", ".")],
+ );
+
+ Command::new(path)
+ .args(args)
+ .envs(envs)
+ .stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .spawn()
+}
+
fn progress_task(
counter: Counter,
cb_sink: CbSink,
options: InstallerOptions,
progress_text: TextContent,
) {
- let child = {
- use std::process::{Command, Stdio};
-
- #[cfg(not(debug_assertions))]
- let (path, args, envs): (&str, [&str; 1], [(&str, &str); 0]) =
- ("proxmox-low-level-installer", ["start-session"], []);
-
- #[cfg(debug_assertions)]
- let (path, args, envs) = (
- std::path::PathBuf::from("./proxmox-low-level-installer"),
- ["-t", "start-session-test"],
- [("PERL5LIB", ".")],
- );
-
- Command::new(path)
- .args(args)
- .envs(envs)
- .stdin(Stdio::piped())
- .stdout(Stdio::piped())
- .spawn()
- };
-
- let mut child = match child {
+ let mut child = match spawn_low_level_installer() {
Ok(child) => child,
Err(err) => {
let _ = cb_sink.send(Box::new(move |siv| {
--
2.41.0
More information about the pve-devel
mailing list