Skip to content

Commit b2c0c1a

Browse files
authored
Unrolled build for #146639
Rollup merge of #146639 - joboet:shared-stdiopipes, r=Mark-Simulacrum std: merge definitions of `StdioPipes` All platforms define this structure the same way, so we can just put it in the `process` module directly.
2 parents 7e4b8d7 + 87a00f6 commit b2c0c1a

File tree

11 files changed

+21
-34
lines changed

11 files changed

+21
-34
lines changed

library/std/src/process.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ impl AsInner<imp::Process> for Child {
268268
}
269269
}
270270

271-
impl FromInner<(imp::Process, imp::StdioPipes)> for Child {
272-
fn from_inner((handle, io): (imp::Process, imp::StdioPipes)) -> Child {
271+
impl FromInner<(imp::Process, StdioPipes)> for Child {
272+
fn from_inner((handle, io): (imp::Process, StdioPipes)) -> Child {
273273
Child {
274274
handle,
275275
stdin: io.stdin.map(ChildStdin::from_inner),
@@ -296,6 +296,15 @@ impl fmt::Debug for Child {
296296
}
297297
}
298298

299+
/// The pipes connected to a spawned process.
300+
///
301+
/// Used to pass pipe handles between this module and [`imp`].
302+
pub(crate) struct StdioPipes {
303+
pub stdin: Option<AnonPipe>,
304+
pub stdout: Option<AnonPipe>,
305+
pub stderr: Option<AnonPipe>,
306+
}
307+
299308
/// A handle to a child process's standard input (stdin).
300309
///
301310
/// This struct is used in the [`stdin`] field on [`Child`].

library/std/src/sys/process/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ mod env;
2424

2525
pub use env::CommandEnvs;
2626
pub use imp::{
27-
Command, CommandArgs, EnvKey, ExitCode, ExitStatus, ExitStatusError, Process, Stdio, StdioPipes,
27+
Command, CommandArgs, EnvKey, ExitCode, ExitStatus, ExitStatusError, Process, Stdio,
2828
};
2929

3030
#[cfg(any(

library/std/src/sys/process/uefi.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub use crate::ffi::OsString as EnvKey;
66
use crate::ffi::{OsStr, OsString};
77
use crate::num::{NonZero, NonZeroI32};
88
use crate::path::Path;
9+
use crate::process::StdioPipes;
910
use crate::sys::fs::File;
1011
use crate::sys::pal::helpers;
1112
use crate::sys::pal::os::error_string;
@@ -27,14 +28,6 @@ pub struct Command {
2728
env: CommandEnv,
2829
}
2930

30-
// passed back to std::process with the pipes connected to the child, if any
31-
// were requested
32-
pub struct StdioPipes {
33-
pub stdin: Option<AnonPipe>,
34-
pub stdout: Option<AnonPipe>,
35-
pub stderr: Option<AnonPipe>,
36-
}
37-
3831
#[derive(Copy, Clone, Debug)]
3932
pub enum Stdio {
4033
Inherit,

library/std/src/sys/process/unix/common.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::collections::BTreeMap;
99
use crate::ffi::{CStr, CString, OsStr, OsString};
1010
use crate::os::unix::prelude::*;
1111
use crate::path::Path;
12+
use crate::process::StdioPipes;
1213
use crate::sys::fd::FileDesc;
1314
use crate::sys::fs::File;
1415
#[cfg(not(target_os = "fuchsia"))]
@@ -104,14 +105,6 @@ pub struct Command {
104105
setsid: bool,
105106
}
106107

107-
// passed back to std::process with the pipes connected to the child, if any
108-
// were requested
109-
pub struct StdioPipes {
110-
pub stdin: Option<AnonPipe>,
111-
pub stdout: Option<AnonPipe>,
112-
pub stderr: Option<AnonPipe>,
113-
}
114-
115108
// passed to do_exec() with configuration of what the child stdio should look
116109
// like
117110
#[cfg_attr(target_os = "vita", allow(dead_code))]

library/std/src/sys/process/unix/fuchsia.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use libc::{c_int, size_t};
22

33
use super::common::*;
44
use crate::num::NonZero;
5+
use crate::process::StdioPipes;
56
use crate::sys::pal::fuchsia::*;
67
use crate::{fmt, io, mem, ptr};
78

library/std/src/sys/process/unix/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ cfg_select! {
2323

2424
pub use imp::{ExitStatus, ExitStatusError, Process};
2525

26-
pub use self::common::{Command, CommandArgs, ExitCode, Stdio, StdioPipes};
26+
pub use self::common::{Command, CommandArgs, ExitCode, Stdio};
2727
pub use crate::ffi::OsString as EnvKey;

library/std/src/sys/process/unix/unix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use libc::{gid_t, uid_t};
1313
use super::common::*;
1414
use crate::io::{self, Error, ErrorKind};
1515
use crate::num::NonZero;
16+
use crate::process::StdioPipes;
1617
use crate::sys::cvt;
1718
#[cfg(target_os = "linux")]
1819
use crate::sys::pal::linux::pidfd::PidFd;

library/std/src/sys/process/unix/unsupported.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use libc::{c_int, pid_t};
33
use super::common::*;
44
use crate::io;
55
use crate::num::NonZero;
6+
use crate::process::StdioPipes;
67
use crate::sys::pal::unsupported::*;
78

89
////////////////////////////////////////////////////////////////////////////////

library/std/src/sys/process/unix/vxworks.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use libc::{self, RTP_ID, c_char, c_int};
44
use super::common::*;
55
use crate::io::{self, ErrorKind};
66
use crate::num::NonZero;
7+
use crate::process::StdioPipes;
78
use crate::sys::{cvt, thread};
89
use crate::{fmt, sys};
910

library/std/src/sys/process/unsupported.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub use crate::ffi::OsString as EnvKey;
33
use crate::ffi::{OsStr, OsString};
44
use crate::num::NonZero;
55
use crate::path::Path;
6+
use crate::process::StdioPipes;
67
use crate::sys::fs::File;
78
use crate::sys::pipe::AnonPipe;
89
use crate::sys::unsupported;
@@ -23,14 +24,6 @@ pub struct Command {
2324
stderr: Option<Stdio>,
2425
}
2526

26-
// passed back to std::process with the pipes connected to the child, if any
27-
// were requested
28-
pub struct StdioPipes {
29-
pub stdin: Option<AnonPipe>,
30-
pub stdout: Option<AnonPipe>,
31-
pub stderr: Option<AnonPipe>,
32-
}
33-
3427
#[derive(Debug)]
3528
pub enum Stdio {
3629
Inherit,

0 commit comments

Comments
 (0)