Skip to content
Snippets Groups Projects
Commit 8cb90636 authored by Per's avatar Per
Browse files

cargo-trust opt understanding somewhat improved

parent 69f63ad0
No related branches found
No related tags found
No related merge requests found
...@@ -66,24 +66,27 @@ fn run() -> Result<i32, failure::Error> { ...@@ -66,24 +66,27 @@ fn run() -> Result<i32, failure::Error> {
let mut args = std::env::args(); let mut args = std::env::args();
// When called by Cargo, the first argument after the binary name will be `trust`. // When called by Cargo, the first argument after the binary name will be `trust`.
if env::args().nth(1) == Some("trust".to_string()) { if env::args().nth(1) != Some("trust".to_string()) {
args.next();
} else {
panic!("internal error"); panic!("internal error");
} }
let mut args: Vec<_> = args.collect(); args.next(); // remove filename
args.remove(0); // Remove executable name
// Get command line options. let args: Vec<_> = args.collect();
// Get command line options. Removes 1st arg ("trust") by default
let opt = Opt::from_iter(&args); let opt = Opt::from_iter(&args);
println!("args {:?}", args);
let mut cargo = Command::new("cargo"); let mut cargo = Command::new("cargo");
// forwarding of user arguments // forwarding of user arguments
cargo.arg("rustc").args(args); cargo.arg("rustc");
if let Some(bin) = &opt.bin {
cargo.args(&["--bin", bin]);
}
if let Some(example) = &opt.example {
cargo.args(&["--example", &example]);
}
// klee specifics // klee specifics
cargo cargo
...@@ -108,7 +111,6 @@ fn run() -> Result<i32, failure::Error> { ...@@ -108,7 +111,6 @@ fn run() -> Result<i32, failure::Error> {
if !status.success() { if !status.success() {
panic!("cargo trust command failed!"); panic!("cargo trust command failed!");
// handle_failed_command(status)
} }
// Try and get the cargo project information. // Try and get the cargo project information.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment