bnto_core/command_options.rs
1// Command options — what a node asks of one external command beyond its
2// program and arguments: extra environment variables, a time limit and the
3// folder it runs in.
4
5use std::path::PathBuf;
6use std::time::Duration;
7
8/// How to run one external command, beyond its program and arguments.
9#[derive(Debug, Clone, Default, PartialEq, Eq)]
10pub struct CommandOptions {
11 /// Variables set for the command only, on top of the environment it
12 /// inherits. The calling process's own environment is never changed.
13 pub env: Vec<(String, String)>,
14 /// Kill the command, and everything it started, once it has run this long.
15 pub timeout: Option<Duration>,
16 /// The folder the command runs in. `None` runs it in the work dir.
17 pub dir: Option<PathBuf>,
18 /// Start from an empty environment plus a short allowlist (PATH, HOME,
19 /// locale, ...) instead of inheriting everything, then add `env`. For
20 /// script mode, so the user's exported secrets and shell startup hooks
21 /// never reach a script that didn't ask for them.
22 pub clear_env: bool,
23}