1
Fork 0

just add one method named creation_flags, fix the tidy error

This commit is contained in:
Ted Mielczarek 2016-11-30 21:31:47 -05:00
parent 8b1c4cbbaf
commit e6975e9748
3 changed files with 7 additions and 19 deletions

View file

@ -1180,7 +1180,8 @@ mod tests {
extern "system" {
fn WaitForDebugEvent(lpDebugEvent: *mut DEBUG_EVENT, dwMilliseconds: DWORD) -> BOOL;
fn ContinueDebugEvent(dwProcessId: DWORD, dwThreadId: DWORD, dwContinueStatus: DWORD) -> BOOL;
fn ContinueDebugEvent(dwProcessId: DWORD, dwThreadId: DWORD,
dwContinueStatus: DWORD) -> BOOL;
}
const DEBUG_PROCESS: DWORD = 1;
@ -1188,7 +1189,7 @@ mod tests {
const DBG_EXCEPTION_NOT_HANDLED: DWORD = 0x80010001;
let mut child = Command::new("cmd")
.add_creation_flags(DEBUG_PROCESS)
.creation_flags(DEBUG_PROCESS)
.stdin(Stdio::piped()).spawn().unwrap();
child.stdin.take().unwrap().write_all(b"exit\r\n").unwrap();
let mut events = 0;

View file

@ -106,23 +106,13 @@ pub trait CommandExt {
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
/// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
#[unstable(feature = "windows_process_extensions", issue = "37827")]
fn set_creation_flags(&mut self, flags: u32) -> &mut process::Command;
/// Add `flags` to the the [process creation flags][1] to be passed to `CreateProcess`.
///
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
/// [1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx
#[unstable(feature = "windows_process_extensions", issue = "37827")]
fn add_creation_flags(&mut self, flags: u32) -> &mut process::Command;
fn creation_flags(&mut self, flags: u32) -> &mut process::Command;
}
#[unstable(feature = "windows_process_extensions", issue = "37827")]
impl CommandExt for process::Command {
fn set_creation_flags(&mut self, flags: u32) -> &mut process::Command {
self.as_inner_mut().set_creation_flags(flags);
self
}
fn add_creation_flags(&mut self, flags: u32) -> &mut process::Command {
self.as_inner_mut().add_creation_flags(flags);
fn creation_flags(&mut self, flags: u32) -> &mut process::Command {
self.as_inner_mut().creation_flags(flags);
self
}
}

View file

@ -126,12 +126,9 @@ impl Command {
pub fn stderr(&mut self, stderr: Stdio) {
self.stderr = Some(stderr);
}
pub fn set_creation_flags(&mut self, flags: u32) {
pub fn creation_flags(&mut self, flags: u32) {
self.flags = flags;
}
pub fn add_creation_flags(&mut self, flags: u32) {
self.flags = self.flags | flags;
}
pub fn spawn(&mut self, default: Stdio, needs_stdin: bool)
-> io::Result<(Process, StdioPipes)> {