mirror of
https://github.com/microsoft/edit.git
synced 2025-12-23 07:07:25 +00:00
11 lines
309 B
Rust
11 lines
309 B
Rust
use std::env::VarError;
|
|
|
|
pub fn env_opt(name: &str) -> String {
|
|
match std::env::var(name) {
|
|
Ok(value) => value,
|
|
Err(VarError::NotPresent) => String::new(),
|
|
Err(VarError::NotUnicode(_)) => {
|
|
panic!("Environment variable `{name}` is not valid Unicode")
|
|
}
|
|
}
|
|
}
|