4 use crate::sys
::fs
::File
;
5 use crate::sys
::pipe
::AnonPipe
;
6 use crate::sys
::{unsupported, Void}
;
7 use crate::sys_common
::process
::CommandEnv
;
9 pub use crate::ffi
::OsString
as EnvKey
;
11 ////////////////////////////////////////////////////////////////////////////////
13 ////////////////////////////////////////////////////////////////////////////////
19 // passed back to std::process with the pipes connected to the child, if any
21 pub struct StdioPipes
{
22 pub stdin
: Option
<AnonPipe
>,
23 pub stdout
: Option
<AnonPipe
>,
24 pub stderr
: Option
<AnonPipe
>,
34 pub fn new(_program
: &OsStr
) -> Command
{
35 Command { env: Default::default() }
38 pub fn arg(&mut self, _arg
: &OsStr
) {}
40 pub fn env_mut(&mut self) -> &mut CommandEnv
{
44 pub fn cwd(&mut self, _dir
: &OsStr
) {}
46 pub fn stdin(&mut self, _stdin
: Stdio
) {}
48 pub fn stdout(&mut self, _stdout
: Stdio
) {}
50 pub fn stderr(&mut self, _stderr
: Stdio
) {}
56 ) -> io
::Result
<(Process
, StdioPipes
)> {
61 impl From
<AnonPipe
> for Stdio
{
62 fn from(pipe
: AnonPipe
) -> Stdio
{
67 impl From
<File
> for Stdio
{
68 fn from(_file
: File
) -> Stdio
{
73 impl fmt
::Debug
for Command
{
74 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
79 pub struct ExitStatus(Void
);
82 pub fn success(&self) -> bool
{
86 pub fn code(&self) -> Option
<i32> {
91 impl Clone
for ExitStatus
{
92 fn clone(&self) -> ExitStatus
{
97 impl Copy
for ExitStatus {}
99 impl PartialEq
for ExitStatus
{
100 fn eq(&self, _other
: &ExitStatus
) -> bool
{
105 impl Eq
for ExitStatus {}
107 impl fmt
::Debug
for ExitStatus
{
108 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
113 impl fmt
::Display
for ExitStatus
{
114 fn fmt(&self, _f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
119 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
120 pub struct ExitCode(bool
);
123 pub const SUCCESS
: ExitCode
= ExitCode(false);
124 pub const FAILURE
: ExitCode
= ExitCode(true);
126 pub fn as_i32(&self) -> i32 {
131 pub struct Process(Void
);
134 pub fn id(&self) -> u32 {
138 pub fn kill(&mut self) -> io
::Result
<()> {
142 pub fn wait(&mut self) -> io
::Result
<ExitStatus
> {
146 pub fn try_wait(&mut self) -> io
::Result
<Option
<ExitStatus
>> {