Update nix dependency

This commit is contained in:
timvisee 2024-03-16 13:31:13 +01:00
parent b22d32b951
commit a1008ad2a7
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
3 changed files with 32 additions and 27 deletions

42
Cargo.lock generated
View File

@ -137,6 +137,12 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "block-buffer"
version = "0.10.4"
@ -188,6 +194,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "chrono"
version = "0.4.35"
@ -237,7 +249,7 @@ version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -436,7 +448,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"fsevent-sys",
]
@ -461,7 +473,7 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"fuchsia-zircon-sys",
]
@ -638,7 +650,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"inotify-sys",
"libc",
]
@ -786,15 +798,6 @@ version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg 1.1.0",
]
[[package]]
name = "minecraft-protocol"
version = "0.1.0"
@ -905,15 +908,14 @@ dependencies = [
[[package]]
name = "nix"
version = "0.26.4"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
"bitflags",
"bitflags 2.4.2",
"cfg-if 1.0.0",
"cfg_aliases",
"libc",
"memoffset",
"pin-utils",
]
[[package]]
@ -922,7 +924,7 @@ version = "4.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"filetime",
"fsevent",
"fsevent-sys",
@ -1233,7 +1235,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]

View File

@ -52,7 +52,7 @@ futures = { version = "0.3", default-features = false, features = ["executor"] }
log = "0.4"
minecraft-protocol = { git = "https://github.com/timvisee/rust-minecraft-protocol", rev = "edfdf87" }
named-binary-tag = "0.6"
nix = "0.26"
nix = { version = "0.28", features = ["process", "signal"] }
notify = "4.0"
pretty_env_logger = "0.5"
proxy-protocol = "0.5"

View File

@ -2,7 +2,10 @@
pub mod windows;
#[cfg(unix)]
use nix::{sys::signal, unistd::Pid};
use nix::{
sys::signal::{self, Signal},
unistd::Pid,
};
/// Force kill process.
///
@ -10,7 +13,7 @@ use nix::{sys::signal, unistd::Pid};
#[allow(unreachable_code)]
pub fn force_kill(pid: u32) -> bool {
#[cfg(unix)]
return unix_signal(pid, signal::SIGKILL);
return unix_signal(pid, Signal::SIGKILL);
#[cfg(windows)]
unsafe {
@ -28,7 +31,7 @@ pub fn force_kill(pid: u32) -> bool {
#[allow(unreachable_code, dead_code, unused_variables)]
pub fn kill_gracefully(pid: u32) -> bool {
#[cfg(unix)]
return unix_signal(pid, signal::SIGTERM);
return unix_signal(pid, Signal::SIGTERM);
unimplemented!(
"gracefully killing Minecraft server process not implemented on non-Unix platforms"
@ -43,7 +46,7 @@ pub fn kill_gracefully(pid: u32) -> bool {
#[allow(unreachable_code)]
pub fn freeze(pid: u32) -> bool {
#[cfg(unix)]
return unix_signal(pid, signal::SIGSTOP);
return unix_signal(pid, Signal::SIGSTOP);
unimplemented!(
"freezing the Minecraft server process is not implemented on non-Unix platforms"
@ -58,7 +61,7 @@ pub fn freeze(pid: u32) -> bool {
#[allow(unreachable_code)]
pub fn unfreeze(pid: u32) -> bool {
#[cfg(unix)]
return unix_signal(pid, signal::SIGCONT);
return unix_signal(pid, Signal::SIGCONT);
unimplemented!(
"unfreezing the Minecraft server process is not implemented on non-Unix platforms"
@ -66,7 +69,7 @@ pub fn unfreeze(pid: u32) -> bool {
}
#[cfg(unix)]
pub fn unix_signal(pid: u32, signal: signal::Signal) -> bool {
pub fn unix_signal(pid: u32, signal: Signal) -> bool {
match signal::kill(Pid::from_raw(pid as i32), signal) {
Ok(()) => true,
Err(err) => {