pub struct ProcessLimits {
pub timeout: Duration,
pub max_input_bytes: usize,
pub max_output_bytes: usize,
pub inherit_env: bool,
}Expand description
Limits for one isolated process call. 单次隔离进程调用的限制。
Fields§
§timeout: DurationWall-clock deadline for one call; on expiry the host kills the child. 单次调用的挂钟超时;到期即由宿主终止子进程。
max_input_bytes: usizeLargest request payload accepted, in bytes. 接受的最大请求负载字节数。
max_output_bytes: usizeLargest response payload accepted, in bytes. Checked against the length the child declares, before the host allocates the buffer. 接受的最大响应负载字节数。以子进程声明的长度为准,在宿主分配缓冲区之前检查。
inherit_env: boolWhether the child inherits this host’s environment. 子进程是否继承本宿主的环境。
The default is true, which is what a host that has always run its plugin
this way expects. Setting it to false clears the environment instead, so
an untrusted plugin cannot read the host’s tokens, credentials, or
configuration out of it; a host that needs to pass something specific adds
it with ProcessProgram::environment, and the plugin executable itself
still starts because it is run by absolute path.
默认是 true,也就是一直这样运行插件的宿主所期望的行为。设为 false 时会清空环境,
使不受信任的插件无法从中读到宿主的令牌、凭据或配置;需要传特定变量的宿主用
ProcessProgram::environment 显式添加,而插件可执行文件本身仍能启动,因为它以绝对
路径执行。