summaryrefslogtreecommitdiffstats
path: root/src/env.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/env.rs b/src/env.rs
index 4c461ff..6ac67f5 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -20,13 +20,19 @@ pub struct V0 {
}
impl Env {
- pub fn new() -> Self {
- Self::V0(V0 {
+ pub fn new() -> anyhow::Result<Self> {
+ let mut vars: std::collections::HashMap<
+ std::ffi::OsString,
+ std::ffi::OsString,
+ > = std::env::vars_os().collect();
+ vars.insert("SHELL".into(), std::env::current_exe()?.into());
+ vars.insert("TERM".into(), "screen".into());
+ Ok(Self::V0(V0 {
idx: 0,
latest_status: std::process::ExitStatus::from_raw(0),
- pwd: std::env::current_dir().unwrap(),
- vars: std::env::vars_os().collect(),
- })
+ pwd: std::env::current_dir()?,
+ vars,
+ }))
}
pub fn idx(&self) -> usize {