summaryrefslogtreecommitdiffstats
path: root/src/env.rs
blob: 31671a3c9b9f8f98fc1302b15a1f9f36077c26c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use std::os::unix::process::ExitStatusExt as _;

pub struct Env {
    latest_status: async_std::process::ExitStatus,
}

impl Env {
    pub fn new(code: i32) -> Self {
        Self {
            latest_status: async_std::process::ExitStatus::from_raw(
                code << 8,
            ),
        }
    }

    pub fn set_status(&mut self, status: async_std::process::ExitStatus) {
        self.latest_status = status;
    }

    pub fn latest_status(&self) -> &async_std::process::ExitStatus {
        &self.latest_status
    }
}