File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed
Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -205,20 +205,12 @@ pub(crate) mod module {
205205 ) -> PyResult < _os:: TerminalSizeData > {
206206 let fd = fd. unwrap_or ( 1 ) ; // default to stdout
207207
208- // For standard streams, use GetStdHandle which returns proper console handles
209- // For other fds, use _get_osfhandle to convert
210- let h = match fd {
211- 0 => unsafe { Console :: GetStdHandle ( Console :: STD_INPUT_HANDLE ) } ,
212- 1 => unsafe { Console :: GetStdHandle ( Console :: STD_OUTPUT_HANDLE ) } ,
213- 2 => unsafe { Console :: GetStdHandle ( Console :: STD_ERROR_HANDLE ) } ,
214- _ => {
215- let borrowed = unsafe { crt_fd:: Borrowed :: borrow_raw ( fd) } ;
216- let handle = crt_fd:: as_handle ( borrowed) . map_err ( |e| e. to_pyexception ( vm) ) ?;
217- handle. as_raw_handle ( ) as _
218- }
219- } ;
208+ // Use _get_osfhandle for all fds
209+ let borrowed = unsafe { crt_fd:: Borrowed :: borrow_raw ( fd) } ;
210+ let handle = crt_fd:: as_handle ( borrowed) . map_err ( |e| e. to_pyexception ( vm) ) ?;
211+ let h = handle. as_raw_handle ( ) as Foundation :: HANDLE ;
220212
221- if h. is_null ( ) || h == INVALID_HANDLE_VALUE {
213+ if h == INVALID_HANDLE_VALUE {
222214 return Err ( errno_err ( vm) ) ;
223215 }
224216
You can’t perform that action at this time.
0 commit comments