pub struct CommandRequest { /* private fields */ }Expand description
A complete portable request to execute one command.
This type describes execution intent only. It does not contain a sandbox policy because policy is a separate Cageforge concern and will be composed by the backend API. It also does not expose PTY handles, inherited file descriptors, process ids, or OS-specific user/token settings.
Implementations§
Source§impl CommandRequest
impl CommandRequest
Sourcepub fn new(command: CommandSpec) -> Self
pub fn new(command: CommandSpec) -> Self
Creates a request with the captured-stdio and inherited-environment defaults.
Sourcepub fn with_working_directory(
self,
path: impl Into<PathBuf>,
) -> Result<Self, CommandError>
pub fn with_working_directory( self, path: impl Into<PathBuf>, ) -> Result<Self, CommandError>
Sets the working directory.
The path is kept in the caller’s native representation. Relative paths are resolved by the backend, but lexical parent traversal is rejected here so a request cannot escape its later execution context by using parent components.
Sourcepub fn without_working_directory(self) -> Self
pub fn without_working_directory(self) -> Self
Removes an explicitly configured working directory.
Sourcepub fn with_environment(self, environment: EnvironmentSpec) -> Self
pub fn with_environment(self, environment: EnvironmentSpec) -> Self
Replaces the environment construction rules.
Sourcepub fn with_stdio(self, stdio: StdioSpec) -> Self
pub fn with_stdio(self, stdio: StdioSpec) -> Self
Replaces standard stream routing.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets an explicit maximum execution duration.
Sourcepub fn with_timeout_policy(self, timeout: TimeoutPolicy) -> Self
pub fn with_timeout_policy(self, timeout: TimeoutPolicy) -> Self
Replaces the timeout intent with an explicit policy.
Sourcepub fn use_backend_timeout(self) -> Self
pub fn use_backend_timeout(self) -> Self
Uses the timeout selected by the backend or resolved profile.
Sourcepub fn disable_timeout(self) -> Self
pub fn disable_timeout(self) -> Self
Disables the automatic timeout while leaving cancellation available to the execution lifecycle.
Sourcepub fn command(&self) -> &CommandSpec
pub fn command(&self) -> &CommandSpec
Returns the command line.
Sourcepub fn working_directory(&self) -> Option<&Path>
pub fn working_directory(&self) -> Option<&Path>
Returns the optional working directory.
Sourcepub fn environment(&self) -> &EnvironmentSpec
pub fn environment(&self) -> &EnvironmentSpec
Returns environment construction rules.
Sourcepub fn timeout_policy(&self) -> TimeoutPolicy
pub fn timeout_policy(&self) -> TimeoutPolicy
Returns the timeout intent.