mirror of
https://github.com/openai/codex.git
synced 2026-05-04 13:21:54 +03:00
Fix toasts on Windows under WSL 2 (#7137)
Before this: no notifications or toasts when using Codex CLI in WSL 2. After this: I get toasts from Codex
This commit is contained in:
19
codex-rs/core/src/env.rs
Normal file
19
codex-rs/core/src/env.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
//! Functions for environment detection that need to be shared across crates.
|
||||
|
||||
/// Returns true if the current process is running under Windows Subsystem for Linux.
|
||||
pub fn is_wsl() -> bool {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if std::env::var_os("WSL_DISTRO_NAME").is_some() {
|
||||
return true;
|
||||
}
|
||||
match std::fs::read_to_string("/proc/version") {
|
||||
Ok(version) => version.to_lowercase().contains("microsoft"),
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user