pub struct ProcessProgram { /* private fields */ }Expand description
Executable, fixed arguments, and child environment for an isolated plugin. 隔离插件使用的程序、固定参数与子进程环境。
Implementations§
Source§impl ProcessProgram
impl ProcessProgram
Sourcepub fn new(executable: impl Into<PathBuf>) -> Self
pub fn new(executable: impl Into<PathBuf>) -> Self
Start a program specification with no fixed arguments. 以无固定参数开始描述一个程序。
Sourcepub fn argument(self, argument: impl Into<String>) -> Self
pub fn argument(self, argument: impl Into<String>) -> Self
Append one fixed argument, passed before every operation name. 追加一个固定参数,它排在每个操作名之前。
Sourcepub fn environment(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn environment( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Set one environment variable for the child. 为子进程设置一个环境变量。
This is the companion of ProcessLimits::inherit_env: with the
environment cleared, these are the only variables the child sees, so a
host passes what the plugin genuinely needs instead of handing over
everything it has.
这是 ProcessLimits::inherit_env 的配套:清空环境后,子进程只看到这里设置的变量,
因此宿主传的是插件真正需要的东西,而不是把自己拥有的一切都交出去。
Sourcepub fn current_dir(self, directory: impl Into<PathBuf>) -> Self
pub fn current_dir(self, directory: impl Into<PathBuf>) -> Self
Run the child in directory instead of the host’s working directory.
让子进程在 directory 中运行,而不是宿主的工作目录。
Sourcepub fn executable(&self) -> &Path
pub fn executable(&self) -> &Path
The configured executable path, before staging. 配置的可执行文件路径,尚未暂存。