wasmer_wasix/journal/effector/
process_exit.rsuse virtual_mio::InlineWaker;
use super::*;
impl JournalEffector {
pub fn save_process_exit(env: &WasiEnv, exit_code: Option<ExitCode>) -> anyhow::Result<()> {
env.active_journal()?
.write(JournalEntry::ProcessExitV1 { exit_code })
.map_err(map_snapshot_err)?;
Ok(())
}
pub unsafe fn apply_process_exit(
ctx: &mut FunctionEnvMut<'_, WasiEnv>,
exit_code: Option<ExitCode>,
) -> anyhow::Result<()> {
let env = ctx.data();
if env.replaying_journal {
let state = env.state.clone();
InlineWaker::block_on(state.fs.close_all());
} else {
env.blocking_on_exit(exit_code);
}
let memory = ctx.data_mut().inner().memory().clone();
memory.reset(ctx)?;
Ok(())
}
}