Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6f87288

Browse files
committed
Use the correct into_* on Windows to avoid dropping a stdio handle.
Use `into_raw_handle()` rather than `into_inner()` to completely consume a `Handle` without dropping its contained handle.
1 parent 9b99f8c commit 6f87288

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/std/src/sys/windows/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::io::{self, Error, ErrorKind};
1515
use crate::mem;
1616
use crate::num::NonZeroI32;
1717
use crate::os::windows::ffi::OsStrExt;
18-
use crate::os::windows::io::{AsRawHandle, FromRawHandle};
18+
use crate::os::windows::io::{AsRawHandle, FromRawHandle, IntoRawHandle};
1919
use crate::path::Path;
2020
use crate::ptr;
2121
use crate::sys::c;
@@ -371,7 +371,7 @@ impl Stdio {
371371
Ok(io) => unsafe {
372372
let io = Handle::from_raw_handle(io);
373373
let ret = io.duplicate(0, true, c::DUPLICATE_SAME_ACCESS);
374-
io.into_inner();
374+
io.into_raw_handle();
375375
ret
376376
},
377377
Err(..) => unsafe { Ok(Handle::from_raw_handle(c::INVALID_HANDLE_VALUE)) },

0 commit comments

Comments
 (0)