Seal CommandExt trait
This is technically a breaking change, but we follow the standard
library's decision that sealing CommandExt is fine.
bfd1ccfb27
This commit is contained in:
parent
7980b4696a
commit
f76d325959
|
@ -82,6 +82,10 @@ pub mod unix;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub mod windows;
|
pub mod windows;
|
||||||
|
|
||||||
|
mod sealed {
|
||||||
|
pub trait Sealed {}
|
||||||
|
}
|
||||||
|
|
||||||
/// An event delivered every time the SIGCHLD signal occurs.
|
/// An event delivered every time the SIGCHLD signal occurs.
|
||||||
static SIGCHLD: Event = Event::new();
|
static SIGCHLD: Event = Event::new();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,10 @@ use std::os::unix::process::CommandExt as _;
|
||||||
use crate::Command;
|
use crate::Command;
|
||||||
|
|
||||||
/// Unix-specific extensions to the [`Command`] builder.
|
/// Unix-specific extensions to the [`Command`] builder.
|
||||||
pub trait CommandExt {
|
///
|
||||||
|
/// This trait is sealed: it cannot be implemented outside `async-process`.
|
||||||
|
/// This is so that future additional methods are not breaking changes.
|
||||||
|
pub trait CommandExt: crate::sealed::Sealed {
|
||||||
/// Sets the child process's user ID. This translates to a
|
/// Sets the child process's user ID. This translates to a
|
||||||
/// `setuid` call in the child process. Failure in the `setuid`
|
/// `setuid` call in the child process. Failure in the `setuid`
|
||||||
/// call will cause the spawn to fail.
|
/// call will cause the spawn to fail.
|
||||||
|
@ -88,6 +91,7 @@ pub trait CommandExt {
|
||||||
S: AsRef<OsStr>;
|
S: AsRef<OsStr>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl crate::sealed::Sealed for Command {}
|
||||||
impl CommandExt for Command {
|
impl CommandExt for Command {
|
||||||
fn uid(&mut self, id: u32) -> &mut Command {
|
fn uid(&mut self, id: u32) -> &mut Command {
|
||||||
self.inner.uid(id);
|
self.inner.uid(id);
|
||||||
|
|
|
@ -6,7 +6,10 @@ use std::os::windows::process::CommandExt as _;
|
||||||
use crate::{Child, Command};
|
use crate::{Child, Command};
|
||||||
|
|
||||||
/// Windows-specific extensions to the [`Command`] builder.
|
/// Windows-specific extensions to the [`Command`] builder.
|
||||||
pub trait CommandExt {
|
///
|
||||||
|
/// This trait is sealed: it cannot be implemented outside `async-process`.
|
||||||
|
/// This is so that future additional methods are not breaking changes.
|
||||||
|
pub trait CommandExt: crate::sealed::Sealed {
|
||||||
/// Sets the [process creation flags][1] to be passed to `CreateProcess`.
|
/// Sets the [process creation flags][1] to be passed to `CreateProcess`.
|
||||||
///
|
///
|
||||||
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
|
/// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
|
||||||
|
@ -15,6 +18,7 @@ pub trait CommandExt {
|
||||||
fn creation_flags(&mut self, flags: u32) -> &mut Command;
|
fn creation_flags(&mut self, flags: u32) -> &mut Command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl crate::sealed::Sealed for Command {}
|
||||||
impl CommandExt for Command {
|
impl CommandExt for Command {
|
||||||
fn creation_flags(&mut self, flags: u32) -> &mut Command {
|
fn creation_flags(&mut self, flags: u32) -> &mut Command {
|
||||||
self.inner.creation_flags(flags);
|
self.inner.creation_flags(flags);
|
||||||
|
|
Loading…
Reference in New Issue