Skip to content

Commit 552f268

Browse files
committed
Add Safety comment to newly added unsafe call.
1 parent 3005fef commit 552f268

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ rust-version = "1.81"
1717
anyhow = "1.0.75"
1818
clap = { version = "4.4.10", features = ["derive"] }
1919
console = "0.15.7"
20-
derive_more = { version = "1.0.0", features = ["display", "from_str"] }
20+
derive_more = { version = "1.0.0", features = [
21+
"display",
22+
"from_str"
23+
] }
2124
# I had some issues with futures-buffered 0.2.9
2225
futures-buffered = "0.2.11"
2326
indicatif = "0.17.7"
@@ -44,7 +47,6 @@ nix = { version = "0.29", features = ["signal"], optional = true }
4447
[target.'cfg(windows)'.dependencies]
4548
windows-sys = { version = "0.59.0", features = ["Win32_System_Console"], optional = true }
4649

47-
4850
[dev-dependencies]
4951
duct = "0.13.6"
5052
nix = { version = "0.29", features = ["signal", "process"] }

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ async fn send(args: SendArgs) -> anyhow::Result<()> {
790790
.unwrap_or_else(|e| eprintln!("Failed to end process: {e}"));
791791

792792
#[cfg(windows)]
793+
// Safety: Raw syscall to re-send the Ctrl+C event to the console
793794
if unsafe { GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) } == 0 {
794795
eprintln!("Failed to end process: {}", std::io::Error::last_os_error());
795796
}

0 commit comments

Comments
 (0)