collections::HashMap,
fmt,
fs::File,
- io::BufReader,
+ io::{self, BufReader},
net::IpAddr,
path::{Path, PathBuf},
+ process::{self, Command, Stdio},
};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
format!("{} {}", self.state.render(), self.name)
}
}
+
+pub fn spawn_low_level_installer(test_mode: bool) -> io::Result<process::Child> {
+ let (path, args, envs): (&str, &[&str], Vec<(&str, &str)>) = if test_mode {
+ (
+ "./proxmox-low-level-installer",
+ &["-t", "start-session-test"],
+ vec![("PERL5LIB", ".")],
+ )
+ } else {
+ ("proxmox-low-level-installer", &["start-session"], vec![])
+ };
+
+ Command::new(path)
+ .args(args)
+ .envs(envs)
+ .stdin(Stdio::piped())
+ .stdout(Stdio::piped())
+ .spawn()
+}
};
use crate::{abort_install_button, setup::InstallConfig, yes_no_dialog, InstallerState};
+use proxmox_installer_common::setup::spawn_low_level_installer;
pub struct InstallProgressView {
view: PaddedView<LinearLayout>,
state: InstallerState,
progress_text: TextContent,
) {
- let child = {
- use std::process::{Command, Stdio};
-
- let (path, args, envs): (&str, &[&str], Vec<(&str, &str)>) = if state.in_test_mode {
- (
- "./proxmox-low-level-installer",
- &["-t", "start-session-test"],
- vec![("PERL5LIB", ".")],
- )
- } else {
- ("proxmox-low-level-installer", &["start-session"], vec![])
- };
-
- 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(state.in_test_mode) {
Ok(child) => child,
Err(err) => {
let _ = cb_sink.send(Box::new(move |siv| {