Fix perror

This commit is contained in:
topjohnwu 2023-07-25 21:03:04 -07:00
parent b191a14a23
commit 9638dc0a66

View File

@ -38,13 +38,13 @@ macro_rules! perror {
($fmt:expr) => { ($fmt:expr) => {
$crate::log_with_formatter($crate::ffi::LogLevel::ErrorCxx, |w| { $crate::log_with_formatter($crate::ffi::LogLevel::ErrorCxx, |w| {
w.write_str($fmt)?; w.write_str($fmt)?;
w.write_fmt(format_args!(" failed with {}: {}", $crate::errno(), error_str())) w.write_fmt(format_args_nl!(" failed with {}: {}", $crate::errno(), error_str()))
}) })
}; };
($fmt:expr, $($args:tt)*) => { ($fmt:expr, $($args:tt)*) => {
$crate::log_with_formatter($crate::ffi::LogLevel::ErrorCxx, |w| { $crate::log_with_formatter($crate::ffi::LogLevel::ErrorCxx, |w| {
w.write_fmt(format_args!($fmt, $($args)*))?; w.write_fmt(format_args!($fmt, $($args)*))?;
w.write_fmt(format_args!(" failed with {}: {}", $crate::errno(), error_str())) w.write_fmt(format_args_nl!(" failed with {}: {}", $crate::errno(), error_str()))
}) })
}; };
} }