std::process (unsupported): Implement From<io::Stdout> etc. for imp::Stdio

This implementation is wrong.  Like the impl for From<File>, it is
forced to panic because process::Stdio in unsupported/process.rs
doesn't have a suitable variant.

The root cause of the problem is that process::Stdio in
unsupported/process.rs has any information in it at all.

I'm pretty sure that it should just be a unit struct.  However,
making that build on all platforms is going to be a lot of work,
iterating through CI and/or wrestling Docker.

I don't think this extra panic is making things significantly worse.
For now I have added some TODOs.
This commit is contained in:
Ian Jackson 2023-09-09 11:24:53 +01:00
parent 36295fad12
commit 436fe01895
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -27,6 +27,8 @@ pub struct StdioPipes {
pub stderr: Option<AnonPipe>,
}
// FIXME: This should be a unit struct, so we can always construct it
// The value here should be never used, since we cannot spawn processes.
pub enum Stdio {
Inherit,
Null,
@ -87,8 +89,26 @@ impl From<AnonPipe> for Stdio {
}
}
impl From<io::Stdout> for Stdio {
fn from(_: io::Stdout) -> Stdio {
// FIXME: This is wrong.
// Instead, the Stdio we have here should be a unit struct.
panic!("unsupported")
}
}
impl From<io::Stderr> for Stdio {
fn from(_: io::Stderr) -> Stdio {
// FIXME: This is wrong.
// Instead, the Stdio we have here should be a unit struct.
panic!("unsupported")
}
}
impl From<File> for Stdio {
fn from(_file: File) -> Stdio {
// FIXME: This is wrong.
// Instead, the Stdio we have here should be a unit struct.
panic!("unsupported")
}
}