Fix parsing in entry: Use std::env::args_os

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-07 17:07:17 +10:00
parent 764a960c90
commit 2ea341381d
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -1,4 +1,5 @@
use std::{
ffi::OsString,
path::PathBuf,
process::{ExitCode, Termination},
str::FromStr,
@ -133,7 +134,7 @@ async fn entry() -> Result<()> {
// Filter extraneous arg when invoked by cargo
// `cargo run -- --help` gives ["target/debug/cargo-binstall", "--help"]
// `cargo binstall --help` gives ["/home/ryan/.cargo/bin/cargo-binstall", "binstall", "--help"]
let mut args: Vec<String> = std::env::args().collect();
let mut args: Vec<OsString> = std::env::args_os().collect();
if args.len() > 1 && args[1] == "binstall" {
args.remove(1);
}