forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocess_unsupported.rs
72 lines (57 loc) · 1.65 KB
/
process_unsupported.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use crate::io;
use crate::num::NonZero;
use crate::sys::pal::unix::unsupported::*;
use crate::sys::process::process_common::*;
use libc::{c_int, pid_t};
////////////////////////////////////////////////////////////////////////////////
// Command
////////////////////////////////////////////////////////////////////////////////
impl Command {
pub fn spawn(
&mut self,
_default: Stdio,
_needs_stdin: bool,
) -> io::Result<(Process, StdioPipes)> {
unsupported()
}
pub fn output(&mut self) -> io::Result<(ExitStatus, Vec<u8>, Vec<u8>)> {
unsupported()
}
pub fn exec(&mut self, _default: Stdio) -> io::Error {
unsupported_err()
}
}
////////////////////////////////////////////////////////////////////////////////
// Processes
////////////////////////////////////////////////////////////////////////////////
pub struct Process {
_handle: pid_t,
}
impl Process {
pub fn id(&self) -> u32 {
0
}
pub fn kill(&mut self) -> io::Result<()> {
unsupported()
}
pub fn wait(&mut self) -> io::Result<ExitStatus> {
unsupported()
}
pub fn try_wait(&mut self) -> io::Result<Option<ExitStatus>> {
unsupported()
}
}
mod wait_status;
pub use wait_status::ExitStatus;
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
pub struct ExitStatusError(NonZero<c_int>);
impl Into<ExitStatus> for ExitStatusError {
fn into(self) -> ExitStatus {
ExitStatus::from(c_int::from(self.0))
}
}
impl ExitStatusError {
pub fn code(self) -> Option<NonZero<i32>> {
ExitStatus::from(c_int::from(self.0)).code().map(|st| st.try_into().unwrap())
}
}