pub fn execute_bad_command<S>(command: &[S], manifest: &str)
where
    S: AsRef<OsStr>,
{
    let subcommand_name = &command[0].as_ref();

    let call = process::Command::new(&get_command_path(subcommand_name))
        .args(command)
        .arg(format!("--manifest-path={}", manifest))
        .env("CARGO_IS_TEST", "1")
        .output()
        .unwrap();

    if call.status.success() {
        println!("Status code: {:?}", call.status);
        println!("STDOUT: {}", String::from_utf8_lossy(&call.stdout));
        println!("STDERR: {}", String::from_utf8_lossy(&call.stderr));
        panic!(
            "cargo-{} success to execute",
            subcommand_name.to_string_lossy()
        )
    }
}
/// Execute localc cargo command, includes `--manifest-path`, expect command failed
Execute localc cargo command, includes `--manifest-path`, expect command failed
Execute localc cargo command includes ` -- manifest - path ` expect command failed
pub fn execute_bad_command<S>(command: &[S], manifest: &str)
where
    S: AsRef<OsStr>,
{
    let subcommand_name = &command[0].as_ref();
    let call = process::Command::new(&get_command_path(subcommand_name))
        .args(command)
        .arg(format!("--manifest-path={}", manifest))
        .env("CARGO_IS_TEST", "1")
        .output()
        .unwrap();
    if call.status.success() {
        println!("Status code: {:?}", call.status);
        println!("STDOUT: {}", String::from_utf8_lossy(&call.stdout));
        println!("STDERR: {}", String::from_utf8_lossy(&call.stderr));
        panic!(
            "cargo-{} success to execute",
            subcommand_name.to_string_lossy()
        )
    }
}
pub fn execute_bad_command < S > ( command : & [ S ] , manifest : & str ) where S : AsRef < OsStr > , { let subcommand_name = & command [ 0 ] . as_ref ( ) ; let call = process :: Command :: new ( & get_command_path ( subcommand_name ) ) . args ( command ) . arg ( format ! ( " " manifest ) ) . env ( " " , " " ) . output ( ) . unwrap ( ) ; if call . status . success ( ) { println ! ( " " call status ) ; println ! ( " " String from_utf8_lossy ( call stdout ) ) ; println ! ( " " String from_utf8_lossy ( call stderr ) ) ; panic ! ( " " subcommand_name to_string_lossy ( ) ) } }
Execute localc cargo command, includes `--manifest-path`, expect command failed
Execute localc cargo command includes ` -- manifest - path ` expect command failed
command
&[S]
manifest
&str