You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/libcontainer/src/hooks.rs
+107-6Lines changed: 107 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ pub fn run_hooks(
39
39
// TODO: Remove the following parameters. To comply with the OCI State, hooks should only depend on structures defined in oci-spec-rs. Cleaning these up ensures proper functional isolation.
40
40
cwd:Option<&Path>,
41
41
pid:Option<Pid>,
42
+
default_env:Option<&HashMap<String,String>>,
42
43
) -> Result<()>{
43
44
let base_state = state.ok_or(HookError::MissingContainerState)?;
44
45
@@ -77,6 +78,8 @@ pub fn run_hooks(
77
78
78
79
let envs:HashMap<String,String> = ifletSome(env) = hook.env(){
79
80
utils::parse_env(env)
81
+
}elseifletSome(default) = default_env {
82
+
default.clone()
80
83
}else{
81
84
HashMap::new()
82
85
};
@@ -195,7 +198,7 @@ mod test {
195
198
fntest_run_hook() -> Result<()>{
196
199
{
197
200
let default_container:Container = Default::default();
0 commit comments