aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authordivens <divens@users.noreply.github.com>2026-05-06 17:02:10 +0200
committerGitHub <noreply@github.com>2026-05-06 17:02:10 +0200
commitcc86e31b840cfd1993f256513047dfe980408398 (patch)
tree0292baf8bcc5dbb109cef03e1623c9ccdf98b9cd /zellij-server
parentIndependent tab sizes (#5133) (diff)
downloadsl0ppij-cc86e31b840cfd1993f256513047dfe980408398.tar.gz
sl0ppij-cc86e31b840cfd1993f256513047dfe980408398.tar.xz
sl0ppij-cc86e31b840cfd1993f256513047dfe980408398.zip
fix(windows): bump windows-sys to 0.59 (#5139)
The workspace `windows-sys` constraint was pinned to 0.52 while the Windows source uses APIs and namespaces from 0.59 (e.g. WriteFile in Win32::Storage::FileSystem). CI built fine because Cargo.lock pinned 0.59, but downstream `cargo install`/`cargo binstall` did fresh resolution and selected 0.52, breaking the build for users on Windows. Align the manifest with the code: - Bump workspace dep `windows-sys` from 0.52 to 0.59. - HANDLE is now `*mut c_void` instead of `isize`: replace `handle == 0` / `!= 0` with `is_null()`, initialise HANDLE locals with `std::ptr::null_mut()`, and pass `null_mut()` as the hTemplateFile argument to CreateFileW. - Pass the process HANDLE through the exit-monitor thread as `usize` (raw pointers are not Send; OS handles are safe to use cross-thread). - Note: HPCON is still `isize` in 0.59, so its zero-init is unchanged.
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/os_input_output_windows.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/zellij-server/src/os_input_output_windows.rs b/zellij-server/src/os_input_output_windows.rs
index a3defae9..410dec2b 100644
--- a/zellij-server/src/os_input_output_windows.rs
+++ b/zellij-server/src/os_input_output_windows.rs
@@ -55,7 +55,8 @@ struct ConPtyTerminal {
input_write_handle: HANDLE,
}
-// HANDLE/HPCON are isize (plain integers), safe to send across threads.
+// HANDLE/HPCON are raw pointers in windows-sys >= 0.59; OS handles are
+// safe to send across threads.
unsafe impl Send for ConPtyTerminal {}
unsafe impl Sync for ConPtyTerminal {}
@@ -222,11 +223,11 @@ fn create_overlapped_output_pipe(terminal_id: u32) -> io::Result<(HANDLE, HANDLE
CreateFileW(
wide_name.as_ptr(),
GENERIC_WRITE,
- 0, // no sharing
- std::ptr::null(), // default security
- OPEN_EXISTING, // pipe already exists
- 0, // synchronous
- 0, // no template
+ 0, // no sharing
+ std::ptr::null(), // default security
+ OPEN_EXISTING, // pipe already exists
+ 0, // synchronous
+ std::ptr::null_mut(), // no template
)
};
if client == INVALID_HANDLE_VALUE {
@@ -350,7 +351,7 @@ fn spawn_child_process(
fn terminate_process(pid: u32) -> std::result::Result<(), std::io::Error> {
unsafe {
let handle = OpenProcess(PROCESS_TERMINATE, 0, pid);
- if handle == 0 {
+ if handle.is_null() {
return Err(std::io::Error::last_os_error());
}
let ok = TerminateProcess(handle, 1);
@@ -400,8 +401,8 @@ impl WindowsPtyBackend {
create_overlapped_output_pipe(terminal_id).with_context(|| err_context(&cmd))?;
// 2. Input pipe pair (anonymous, both synchronous)
- let mut input_read: HANDLE = 0;
- let mut input_write: HANDLE = 0;
+ let mut input_read: HANDLE = std::ptr::null_mut();
+ let mut input_write: HANDLE = std::ptr::null_mut();
if unsafe { CreatePipe(&mut input_read, &mut input_write, std::ptr::null(), 0) } == 0 {
unsafe {
CloseHandle(output_read);
@@ -457,8 +458,12 @@ impl WindowsPtyBackend {
);
// 7. Exit-monitoring thread (zero CPU — spends all time in kernel wait)
+ // Pass the HANDLE through as `usize` because raw pointers are not
+ // Send. Windows OS handles are safe to use cross-thread.
let cmd_for_monitor = cmd.clone();
+ let process_handle_addr = process_handle as usize;
std::thread::spawn(move || {
+ let process_handle = process_handle_addr as HANDLE;
let exit_code = unsafe {
WaitForSingleObject(process_handle, INFINITE);
let mut code: u32 = 0;