diff options
| author | bors <bors@rust-lang.org> | 2025-05-16 05:45:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-05-16 05:45:37 +0000 |
| commit | c79bbfab78dcb0a72aa3b2bc35c00334b58bfe2e (patch) | |
| tree | d6f39db82b528e67936230e39ad6c460d8904977 /library/std/src/sys/process | |
| parent | 7e19eef048ba58c28c70afbf5f95da4829c15796 (diff) | |
| parent | 5ce27f572ff4a5ba50146dc70aa5397b24a3f20a (diff) | |
| download | rust-c79bbfab78dcb0a72aa3b2bc35c00334b58bfe2e.tar.gz rust-c79bbfab78dcb0a72aa3b2bc35c00334b58bfe2e.zip | |
Auto merge of #141066 - matthiaskrgr:rollup-e7tyrj5, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #140791 (std: explain prefer `TryInto` over `TryFrom` when specifying traits bounds on generic function) - #140834 (move (or remove) some impl Trait tests) - #140910 (Remove `stable` attribute from wasi fs (read_exact|write_all)_at) - #140984 (fix doc for UnixStream) - #140997 (Add negative test coverage for `-Clink-self-contained` and `-Zlinker-features`) - #141003 (Improve ternary operator recovery) - #141009 (Migrate to modern datetime API) - #141013 (Implement methods to set STARTUPINFO flags for Command API on Windows) - #141026 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys/process')
| -rw-r--r-- | library/std/src/sys/process/windows.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/library/std/src/sys/process/windows.rs b/library/std/src/sys/process/windows.rs index 4acd753eec9..1ee3fbd285f 100644 --- a/library/std/src/sys/process/windows.rs +++ b/library/std/src/sys/process/windows.rs @@ -155,6 +155,9 @@ pub struct Command { stdout: Option<Stdio>, stderr: Option<Stdio>, force_quotes_enabled: bool, + startupinfo_fullscreen: bool, + startupinfo_untrusted_source: bool, + startupinfo_force_feedback: Option<bool>, } pub enum Stdio { @@ -186,6 +189,9 @@ impl Command { stdout: None, stderr: None, force_quotes_enabled: false, + startupinfo_fullscreen: false, + startupinfo_untrusted_source: false, + startupinfo_force_feedback: None, } } @@ -222,6 +228,18 @@ impl Command { self.args.push(Arg::Raw(command_str_to_append.to_os_string())) } + pub fn startupinfo_fullscreen(&mut self, enabled: bool) { + self.startupinfo_fullscreen = enabled; + } + + pub fn startupinfo_untrusted_source(&mut self, enabled: bool) { + self.startupinfo_untrusted_source = enabled; + } + + pub fn startupinfo_force_feedback(&mut self, enabled: Option<bool>) { + self.startupinfo_force_feedback = enabled; + } + pub fn get_program(&self) -> &OsStr { &self.program } @@ -343,6 +361,24 @@ impl Command { si.wShowWindow = cmd_show; } + if self.startupinfo_fullscreen { + si.dwFlags |= c::STARTF_RUNFULLSCREEN; + } + + if self.startupinfo_untrusted_source { + si.dwFlags |= c::STARTF_UNTRUSTEDSOURCE; + } + + match self.startupinfo_force_feedback { + Some(true) => { + si.dwFlags |= c::STARTF_FORCEONFEEDBACK; + } + Some(false) => { + si.dwFlags |= c::STARTF_FORCEOFFFEEDBACK; + } + None => {} + } + let si_ptr: *mut c::STARTUPINFOW; let mut si_ex; |
