From 701643848aa142c0f7d35e62816a52bfb2df6168 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Sun, 14 Apr 2024 18:49:09 +0200 Subject: [PATCH] =?UTF-8?q?error=20:=20valeur=20par=20d=C3=A9faut=20pour?= =?UTF-8?q?=20le=20nom=20du=20programme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/error.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/error.rs b/src/error.rs index c7d3082..722a62b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,7 +1,9 @@ +use std::env; +use std::fmt::{Display, Formatter, Result}; use std::path::Path; pub fn print_error(message: &str) { - let name = std::env::args().next().unwrap(); + let name = env::args().next().unwrap_or(String::from("rash")); let name = Path::new(&name).file_name().unwrap().to_str().unwrap(); eprintln!("{}: {}", name, message);