1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::{bindings::cli::exit, I32Exit, WasiImpl, WasiView};

impl<T> exit::Host for WasiImpl<T>
where
    T: WasiView,
{
    fn exit(&mut self, status: Result<(), ()>) -> anyhow::Result<()> {
        let status = match status {
            Ok(()) => 0,
            Err(()) => 1,
        };
        Err(anyhow::anyhow!(I32Exit(status)))
    }
}