diff options
| author | sigoden <sigoden@gmail.com> | 2024-09-10 18:35:34 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-10 18:35:34 +0800 |
| commit | e181ae9b0d4814a7c005c94837426126dde63c6c (patch) | |
| tree | ed727036d586f0673198a4b30217bbe2e34a094b /src/utils/command.rs | |
| parent | 84e9515509c559ed01e4b0a67539f10cd2c065e6 (diff) | |
| download | aichat-e181ae9b0d4814a7c005c94837426126dde63c6c.tar.gz | |
refactor: extract built-in roles to embedded files (#853)
Diffstat (limited to 'src/utils/command.rs')
| -rw-r--r-- | src/utils/command.rs | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/utils/command.rs b/src/utils/command.rs index caf70c7..8afef14 100644 --- a/src/utils/command.rs +++ b/src/utils/command.rs @@ -5,24 +5,9 @@ use std::{collections::HashMap, env, ffi::OsStr, path::Path, process::Command}; use anyhow::{anyhow, bail, Context, Result}; lazy_static::lazy_static! { - pub static ref OS: String = detect_os(); pub static ref SHELL: Shell = detect_shell(); } -pub fn detect_os() -> String { - let os = env::consts::OS; - if os == "linux" { - if let Ok(contents) = std::fs::read_to_string("/etc/os-release") { - for line in contents.lines() { - if let Some(id) = line.strip_prefix("ID=") { - return format!("{os} ({id})"); - } - } - } - } - os.to_string() -} - pub struct Shell { pub name: String, pub cmd: String, |
