tensor-programming 6 ani în urmă
părinte
comite
55a2085f99
1 a modificat fișierele cu 42 adăugiri și 2 ștergeri
  1. 42 2
      tools/rust/cargo-proton-bundle/src/bundle/wix.rs

+ 42 - 2
tools/rust/cargo-proton-bundle/src/bundle/wix.rs

@@ -167,9 +167,9 @@ fn run_candle(
   let candle_exe = wix_toolset_path.join("candle.exe");
   info!(logger, "running candle for {}", wxs_file_name);
 
-  let mut cmd = std::process::Command::new(&candle_exe)
+  let mut cmd = Command::new(&candle_exe)
     .args(&args)
-    .stdout(std::process::Stdio::piped())
+    .stdout(Stdio::piped())
     .current_dir(build_path)
     .spawn()
     .expect("error running candle.exe");
@@ -189,3 +189,43 @@ fn run_candle(
     Err("error running candle.exe".to_string())
   }
 }
+
+fn run_light(
+  logger: &Logger,
+  wix_toolset_path: &Path,
+  build_path: &Path,
+  wixobjs: &[&str],
+  output_path: &Path,
+) -> Result<(), String> {
+  let light_exe = wix_toolset_path.join("light.exe");
+
+  let mut args: Vec<String> = vec!["-o".to_string(), output_path.display().to_string()];
+
+  for p in wixobjs {
+    args.push(p.to_string());
+  }
+
+  info!(logger, "running light to produce {}", output_path.display());
+
+  let mut cmd = Command::new(&light_exe)
+    .args(&args)
+    .stdout(Stdio::piped())
+    .current_dir(build_path)
+    .spawn()
+    .expect("error running light.exe");
+  {
+    let stdout = cmd.stdout.as_mut().unwrap();
+    let reader = BufReader::new(stdout);
+
+    for line in reader.lines() {
+      info!(logger, "{}", line.unwrap());
+    }
+  }
+
+  let status = cmd.wait().unwrap();
+  if status.success() {
+    Ok(())
+  } else {
+    Err("error running light.exe".to_string())
+  }
+}