[pve-devel] [PATCH installer] tui: honor test mode flag when starting low-level install session

Christoph Heiss c.heiss at proxmox.com
Wed Sep 20 13:39:35 CEST 2023


Even if the installer is run in release mode, the test-mode flag should
be honored on whether to start a test-installation or not.

The test mode is always forced on in debug builds, so the cfg()
conditionals can be dropped.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 proxmox-tui-installer/src/main.rs | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 23a4ead..3f01713 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -727,6 +727,7 @@ fn install_progress_dialog(siv: &mut Cursive) -> InstallerView {
 
     let cb_sink = siv.cb_sink().clone();
     let state = siv.user_data::<InstallerState>().unwrap();
+    let in_test_mode = state.in_test_mode;
     let progress_text = TextContent::new("starting the installation ..");
 
     let progress_task = {
@@ -736,16 +737,15 @@ fn install_progress_dialog(siv: &mut Cursive) -> InstallerView {
             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) = (
-                    PathBuf::from("./proxmox-low-level-installer"),
-                    ["-t", "start-session-test"],
-                    [("PERL5LIB", ".")],
-                );
+                let (path, args, envs): (&str, &[&str], Vec<(&str, &str)>) = if 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)
-- 
2.41.0






More information about the pve-devel mailing list