forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#96725 - nico-abram:win_tid, r=ChrisDenton
Expose process windows_process_extensions_main_thread_handle on Windows ~~I did not find any tests in https://github.com/rust-lang/rust/blob/7d3e03666a93bd2b0f78b3933f9305832af771a5/library/std/src/sys/windows/process/tests.rs that actually launch processes, so I haven't added tests for this.~~ I ran the following locally, to check that it works as expected: ```rs #![feature(windows_process_extensions_main_thread_handle)] fn main() { use std::os::windows::process::{ChildExt, CommandExt}; const CREATE_SUSPENDED: u32 = 0x00000004; let proc = std::process::Command::new("cmd") .args(["/C", "echo hello"]) .creation_flags(CREATE_SUSPENDED) .spawn() .unwrap(); extern "system" { fn ResumeThread(_: *mut std::ffi::c_void) -> u32; } unsafe { ResumeThread(proc.main_thread_handle()); } let output = proc.wait_with_output().unwrap(); let str_output = std::str::from_utf8(&output.stdout[..]).unwrap(); println!("{}", str_output); } ``` Without the feature attribute it wouldn't compile, and commenting the `ResumeThread` line makes it hang forever, showing that it works. Trakcing issue rust-lang#96723
- Loading branch information
Showing
3 changed files
with
52 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters