mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 23:39:35 +00:00
feat: Implement cross-compilation with target inheritance and host defaults
This commit is contained in:
@@ -7,10 +7,12 @@ use std::process::Command;
|
||||
pub fn run_binary(project_name: &str, profile: &str, target_dir: Option<&str>) -> i32 {
|
||||
let bin_path = platform::bin_path(profile, project_name, target_dir);
|
||||
if Path::new(&bin_path).exists() {
|
||||
return Command::new(bin_path)
|
||||
.status()
|
||||
.map(|status| status.code().unwrap_or(1))
|
||||
.unwrap_or(1);
|
||||
let output = Command::new(&bin_path)
|
||||
.output()
|
||||
.unwrap_or_else(|_| panic!("Failed to run {}", bin_path));
|
||||
print!("{}", String::from_utf8_lossy(&output.stdout));
|
||||
eprint!("{}", String::from_utf8_lossy(&output.stderr));
|
||||
return output.status.code().unwrap_or(1);
|
||||
}
|
||||
|
||||
if target_dir.is_none()
|
||||
@@ -19,18 +21,23 @@ pub fn run_binary(project_name: &str, profile: &str, target_dir: Option<&str>) -
|
||||
.contains(&profile.to_string())
|
||||
{
|
||||
warn("Launch of the latest release");
|
||||
return Command::new(platform::bin_path(profile, project_name, target_dir))
|
||||
.status()
|
||||
.map(|status| status.code().unwrap_or(1))
|
||||
.unwrap_or(1);
|
||||
let bin_path = platform::bin_path(profile, project_name, target_dir);
|
||||
let output = Command::new(&bin_path)
|
||||
.output()
|
||||
.unwrap_or_else(|_| panic!("Failed to run {}", &bin_path));
|
||||
print!("{}", String::from_utf8_lossy(&output.stdout));
|
||||
eprint!("{}", String::from_utf8_lossy(&output.stderr));
|
||||
return output.status.code().unwrap_or(1);
|
||||
}
|
||||
|
||||
if target_dir.is_some() && Path::new(&bin_path).exists() {
|
||||
warn("Launch of the latest release");
|
||||
return Command::new(bin_path)
|
||||
.status()
|
||||
.map(|status| status.code().unwrap_or(1))
|
||||
.unwrap_or(1);
|
||||
let output = Command::new(&bin_path)
|
||||
.output()
|
||||
.unwrap_or_else(|_| panic!("Failed to run {}", &bin_path));
|
||||
print!("{}", String::from_utf8_lossy(&output.stdout));
|
||||
eprint!("{}", String::from_utf8_lossy(&output.stderr));
|
||||
return output.status.code().unwrap_or(1);
|
||||
}
|
||||
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user