From 0daa03875c4c7b2cfd538e2ebe4e7dcf017c28a7 Mon Sep 17 00:00:00 2001 From: Ryan Liddle Date: Tue, 5 Feb 2019 22:14:14 +1100 Subject: [PATCH] windows fixes for os module --- vm/src/stdlib/os.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index ded5adc7a..41d9a84c6 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -30,17 +30,18 @@ pub fn rust_file(raw_fileno: i32) -> File { } #[cfg(target_family = "windows")] -pub fn rust_file(handle: File) -> i32 { +pub fn raw_file_number(handle: File) -> i32 { use std::os::windows::io::IntoRawHandle; - handle.into_raw_handle() + handle.into_raw_handle() as i32 } #[cfg(target_family = "windows")] pub fn rust_file(raw_fileno: i32) -> File { - use std::os::unix::io::FromRawHandle; + use std::os::windows::io::FromRawHandle; + use std::ffi::c_void; - unsafe { File::from_raw_handle(raw_fileno) } + unsafe { File::from_raw_handle(raw_fileno as *mut c_void)} } pub fn os_close(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {