Refact, use std::io::Error::from_raw_os_error() to format message

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-11-20 17:22:14 +08:00
parent c85682de8d
commit c6d587f0c7
2 changed files with 26 additions and 8 deletions

View File

@@ -1738,11 +1738,11 @@ pub fn create_process_with_logon(user: &str, pwd: &str, exe: &str, arg: &str) ->
{
let last_error = GetLastError();
bail!(
"CreateProcessWithLogonW failed : \"{}\", errno={}",
"CreateProcessWithLogonW failed : \"{}\", error {:?}",
last_error_table
.get(&last_error)
.unwrap_or(&"Unknown error"),
last_error
io::Error::from_raw_os_error(last_error as _)
);
}
}