Skip to content

Commit e6975e9

Browse files
committed
just add one method named creation_flags, fix the tidy error
1 parent 8b1c4cb commit e6975e9

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

src/libstd/process.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1180,15 +1180,16 @@ mod tests {
11801180

11811181
extern "system" {
11821182
fn WaitForDebugEvent(lpDebugEvent: *mut DEBUG_EVENT, dwMilliseconds: DWORD) -> BOOL;
1183-
fn ContinueDebugEvent(dwProcessId: DWORD, dwThreadId: DWORD, dwContinueStatus: DWORD) -> BOOL;
1183+
fn ContinueDebugEvent(dwProcessId: DWORD, dwThreadId: DWORD,
1184+
dwContinueStatus: DWORD) -> BOOL;
11841185
}
11851186

11861187
const DEBUG_PROCESS: DWORD = 1;
11871188
const EXIT_PROCESS_DEBUG_EVENT: DWORD = 5;
11881189
const DBG_EXCEPTION_NOT_HANDLED: DWORD = 0x80010001;
11891190

11901191
let mut child = Command::new("cmd")
1191-
.add_creation_flags(DEBUG_PROCESS)
1192+
.creation_flags(DEBUG_PROCESS)
11921193
.stdin(Stdio::piped()).spawn().unwrap();
11931194
child.stdin.take().unwrap().write_all(b"exit\r\n").unwrap();
11941195
let mut events = 0;

src/libstd/sys/windows/ext/process.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,13 @@ pub trait CommandExt {
106106
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
107107
/// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
108108
#[unstable(feature = "windows_process_extensions", issue = "37827")]
109-
fn set_creation_flags(&mut self, flags: u32) -> &mut process::Command;
110-
/// Add `flags` to the the [process creation flags][1] to be passed to `CreateProcess`.
111-
///
112-
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
113-
/// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
114-
#[unstable(feature = "windows_process_extensions", issue = "37827")]
115-
fn add_creation_flags(&mut self, flags: u32) -> &mut process::Command;
109+
fn creation_flags(&mut self, flags: u32) -> &mut process::Command;
116110
}
117111

118112
#[unstable(feature = "windows_process_extensions", issue = "37827")]
119113
impl CommandExt for process::Command {
120-
fn set_creation_flags(&mut self, flags: u32) -> &mut process::Command {
121-
self.as_inner_mut().set_creation_flags(flags);
122-
self
123-
}
124-
fn add_creation_flags(&mut self, flags: u32) -> &mut process::Command {
125-
self.as_inner_mut().add_creation_flags(flags);
114+
fn creation_flags(&mut self, flags: u32) -> &mut process::Command {
115+
self.as_inner_mut().creation_flags(flags);
126116
self
127117
}
128118
}

src/libstd/sys/windows/process.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,9 @@ impl Command {
126126
pub fn stderr(&mut self, stderr: Stdio) {
127127
self.stderr = Some(stderr);
128128
}
129-
pub fn set_creation_flags(&mut self, flags: u32) {
129+
pub fn creation_flags(&mut self, flags: u32) {
130130
self.flags = flags;
131131
}
132-
pub fn add_creation_flags(&mut self, flags: u32) {
133-
self.flags = self.flags | flags;
134-
}
135132

136133
pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
137134
-> io::Result<(Process, StdioPipes)> {

0 commit comments

Comments
 (0)