1use anyhow::anyhow;2use anyhow::Result;3use std::ffi::{OsStr, OsString};45pub fn parse_os(os: &OsStr) -> Result<Vec<OsString>> {6 Ok(shlex::bytes::split(os.as_encoded_bytes())7 .ok_or_else(|| anyhow!("invalid arguments"))?8 .into_iter()9 .map(|a| {10 // Unpaired surrogates are not touched11 unsafe { OsString::from_encoded_bytes_unchecked(a) }12 })13 .collect())14}15// pub fn parse(s: &str) -> Result<Vec<OsString>> {16// let osstr = OsString::try_from(s)?;17// parse_os(&osstr)18// }difftreelog
source
cmds/fleet/src/extra_args.rs489 Bsourcehistory