try running through shell
This commit is contained in:
parent
1f75f88293
commit
32e40ca0c1
1 changed files with 12 additions and 20 deletions
|
|
@ -10,37 +10,29 @@ fn main() {
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={}", webui_src_dir.to_str().unwrap());
|
println!("cargo:rerun-if-changed={}", webui_src_dir.to_str().unwrap());
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
|
||||||
let npm = "npm";
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let npm = "npm.exe";
|
let (shell, shell_args) = (
|
||||||
|
r#"C:\Program Files\PowerShell\7\pwsh.EXE"#,
|
||||||
|
["-command"].as_slice(),
|
||||||
|
);
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
let (shell, shell_args) = ("bash", ["-c"].as_slice());
|
||||||
|
|
||||||
// Run "npm install && npm run build" in the webui directory
|
// Run "npm install && npm run build" in the webui directory
|
||||||
for (cmd, args) in [
|
for cmd in ["npm install", "npm run build"] {
|
||||||
(npm, ["install"].as_slice()),
|
|
||||||
(npm, ["run", "build"].as_slice()),
|
|
||||||
] {
|
|
||||||
// Run "npm install" in the webui directory
|
// Run "npm install" in the webui directory
|
||||||
let output = Command::new(cmd)
|
let output = Command::new(shell)
|
||||||
.args(args)
|
.args(shell_args)
|
||||||
|
.arg(cmd)
|
||||||
.current_dir(webui_dir)
|
.current_dir(webui_dir)
|
||||||
.output()
|
.output()
|
||||||
.with_context(|| {
|
.with_context(|| format!("Failed to execute {} in {:?}", cmd, webui_dir))
|
||||||
format!(
|
|
||||||
"Failed to execute {} {} in {:?}",
|
|
||||||
cmd,
|
|
||||||
args.join(" "),
|
|
||||||
webui_dir
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
panic!(
|
panic!(
|
||||||
"{} {} failed. stderr: {}. stdout: {}",
|
"{} failed. stderr: {}. stdout: {}",
|
||||||
cmd,
|
cmd,
|
||||||
args.join(" "),
|
|
||||||
String::from_utf8_lossy(&output.stderr),
|
String::from_utf8_lossy(&output.stderr),
|
||||||
String::from_utf8_lossy(&output.stdout)
|
String::from_utf8_lossy(&output.stdout)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue