ralph_workflow/diagnostics/runtime/
mod.rs1use std::path::PathBuf;
7
8pub use crate::executor::ProcessExecutor;
9
10pub fn get_os_info() -> String {
12 format!("{} {}", std::env::consts::OS, std::env::consts::ARCH)
13}
14
15pub fn get_working_directory() -> std::io::Result<PathBuf> {
17 std::env::current_dir()
18}
19
20pub fn get_shell() -> Option<String> {
22 std::env::var("SHELL").ok()
23}
24
25pub fn get_arch() -> &'static str {
27 std::env::consts::ARCH
28}
29
30pub fn is_git_repo(executor: &dyn ProcessExecutor) -> bool {
32 executor
33 .execute("git", &["rev-parse", "--git-dir"], &[], None)
34 .map(|o| o.status.success())
35 .unwrap_or(false)
36}
37
38pub fn get_os() -> &'static str {
40 std::env::consts::OS
41}