42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use std::io;
|
|
use std::process::Command;
|
|
use std::sync::atomic::Ordering;
|
|
|
|
use crate::{Args, EXIT_OK};
|
|
|
|
pub fn orcx(release: bool, _args: &Args, argv: &[String]) -> io::Result<()> {
|
|
let mut std_build_cmd = Command::new("cargo");
|
|
std_build_cmd.args(["build", "-p", "orchid-std", "--quiet"]);
|
|
if release {
|
|
std_build_cmd.arg("--release");
|
|
}
|
|
|
|
if !std_build_cmd.status()?.success() {
|
|
EXIT_OK.store(false, Ordering::Relaxed);
|
|
return Ok(());
|
|
}
|
|
let mut run_cmd = Command::new("cargo");
|
|
run_cmd.args(["run", "-p", "orcx", "--quiet"]);
|
|
if release {
|
|
run_cmd.arg("--release");
|
|
}
|
|
run_cmd.arg("--");
|
|
run_cmd.args(argv);
|
|
if !run_cmd.status()?.success() {
|
|
EXIT_OK.store(false, Ordering::Relaxed);
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
pub fn orcxdb(_args: &Args, argv: &[String]) -> io::Result<()> {
|
|
if !Command::new("cargo").args(["build", "-p", "orchid-std", "--quiet"]).status()?.success() {
|
|
EXIT_OK.store(false, Ordering::Relaxed);
|
|
return Ok(());
|
|
}
|
|
let path = format!("./target/debug/orcx{}", std::env::consts::EXE_SUFFIX);
|
|
if !Command::new("lldb").args([&path]).args(argv).status()?.success() {
|
|
EXIT_OK.store(false, Ordering::Relaxed);
|
|
}
|
|
Ok(())
|
|
}
|