From 554468932151a295cf634f2d9c9a3195111dd49b Mon Sep 17 00:00:00 2001 From: Oren Watson Date: Sat, 21 Jan 2023 09:40:35 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20crash=20when=20calling=20a=20command=20wi?= =?UTF-8?q?th=20a=20name=20like=20r=C3=BFd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 69da220..fc21425 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,21 +1,21 @@ #![allow(non_snake_case)] -use std::{env, io, os::unix::process::CommandExt, process::Command}; +use std::{env, io, os::unix::process::CommandExt, process::Command, ffi::OsString}; use syslog::{unix, Facility::LOG_AUTH, Formatter3164}; fn main() -> io::Result<()> { - if env::args().nth(0).unwrap() != "🥺" { + if env::args_os().nth(0).unwrap() != "🥺" { eprintln!("error: called 🥺 with name {}", env::args().nth(0).unwrap()); return Ok(()); } - if env::args().len() == 1 { + if env::args_os().len() == 1 { eprintln!("usage: {} [args]", env::args().nth(0).unwrap()); return Ok(()); } - let program = env::args().nth(1).unwrap(); - let args = env::args().skip(2).collect::>(); + let program = env::args_os().nth(1).unwrap(); + let args = env::args_os().skip(2).collect::>(); let mut writer = unix(Formatter3164 { facility: LOG_AUTH, hostname: None,