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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
extern crate libc;
extern crate nix;
mod namespace;
mod idmap;
mod chroot;
mod ffi_util;
mod std_api;
mod config;
mod error;
mod pipe;
mod child;
mod linux;
mod fds;
mod run;
mod status;
mod wait;
mod stdio;
mod debug;
mod zombies;
pub use error::Error;
pub use status::ExitStatus;
pub use stdio::{Stdio, Fd};
pub use pipe::{PipeReader, PipeWriter};
pub use namespace::{Namespace};
pub use idmap::{UidMap, GidMap};
pub use zombies::{reap_zombies, child_events, ChildEvent};
pub use nix::sys::signal::SigNum;
use std::ffi::{CString, OsString};
use std::path::PathBuf;
use std::os::unix::io::RawFd;
use std::collections::HashMap;
use pipe::PipeHolder;
use libc::{pid_t};
pub struct Command {
filename: CString,
args: Vec<CString>,
environ: Option<HashMap<OsString, OsString>>,
config: config::Config,
fds: HashMap<RawFd, Fd>,
close_fds: Vec<(RawFd, RawFd)>,
chroot_dir: Option<PathBuf>,
pivot_root: Option<(PathBuf, PathBuf, bool)>,
id_map_commands: Option<(PathBuf, PathBuf)>,
}
#[derive(Debug)]
pub struct Child {
pid: pid_t,
status: Option<ExitStatus>,
fds: HashMap<RawFd, PipeHolder>,
pub stdin: Option<PipeWriter>,
pub stdout: Option<PipeReader>,
pub stderr: Option<PipeReader>,
}