Open ebkalderon opened 4 years ago
Documented the current limitation in commit a252d44.
At the time of writing, we use Cargo features to set the stdio configuration for the launched process. This is not ideal and will be replaced by a dedicated Rust API in the future, but the approach works well enough for now. The following modes are available, as defined in the Cargo.toml
:
Feature | stdin | stdout | stderr |
---|---|---|---|
default |
Inherit | Inherit | Inherit |
piped |
Piped | Piped | Piped |
piped-merged |
Piped | Piped | Merged with stdout |
Because we cannot extract and inspect the
std::process::Stdio
from thestd::process::Command
builder passed toSandbox::spawn()
, we cannot determine at runtime whether to pipe or inherit our stdin/stdout/stderr descriptors. As a result, Bastille currently defaults toStdio::inherit()
for all three by default and can be switched to piped stdin/stdout/stderr if compiled with thepiped
Cargo feature.This is not at all ideal, but fixing this requires resolving rust-lang/rust#44434 and also finding some way to inspect whether a given
std::process::Stdio
is set to "inherit," "piped," or "null."An alternative but less desirable approach would be to implement our own in-crate
Stdio
type like how we currently do withChild
. Still, it would be best to reuse as manystd::process
types as possible when configuring and spawning commands in Bastille.