From f288e7c0b2c51badfa2efa72ae6f1f8b967db0bf Mon Sep 17 00:00:00 2001 From: yjhmelody <465402634@qq.com> Date: Sat, 17 Aug 2019 17:14:10 +0800 Subject: [PATCH] update Signed-off-by: yjhmelody <465402634@qq.com> --- vm/src/stdlib/os.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index f0550d587..b4d52fe09 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -6,6 +6,8 @@ use std::fs::OpenOptions; use std::io::{self, Error, ErrorKind, Read, Write}; #[cfg(unix)] use std::os::unix::fs::OpenOptionsExt; +#[cfg(windows)] +use std::os::windows::fs::OpenOptionsExt; use std::time::{Duration, SystemTime}; use std::{env, fs}; @@ -91,6 +93,7 @@ pub fn os_close(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { Ok(vm.get_none()) } +#[cfg(any(unix, windows))] pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { arg_check!( vm, @@ -126,6 +129,11 @@ pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { Ok(vm.ctx.new_int(raw_file_number(handle))) } +#[cfg(all(not(unix), not(windows)))] +pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult { + unimplemented!() +} + pub fn convert_io_error(vm: &VirtualMachine, err: io::Error) -> PyObjectRef { let os_error = match err.kind() { ErrorKind::NotFound => {