Implement Display for Signal on windows

This commit is contained in:
Félix Saparelli 2021-04-11 04:44:13 +12:00
parent 2e85658a12
commit 0ade9dfc3a
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 22 additions and 0 deletions

View File

@ -28,6 +28,28 @@ pub enum Signal {
SIGUSR2,
}
#[cfg(windows)]
impl fmt::Display for Signal {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use std::io::Write;
use Self::*;
write!(
f,
match self {
SIGKILL => "SIGKILL",
SIGTERM => "SIGTERM",
SIGINT => "SIGINT",
SIGHUP => "SIGHUP",
SIGSTOP => "SIGSTOP",
SIGCONT => "SIGCONT",
SIGCHLD => "SIGCHLD",
SIGUSR1 => "SIGUSR1",
SIGUSR2 => "SIGUSR2",
}
)
}
}
#[cfg(unix)]
use nix::libc::*;