diff options
Diffstat (limited to 'src/platform/linux.rs')
| -rw-r--r-- | src/platform/linux.rs | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/src/platform/linux.rs b/src/platform/linux.rs index e700a7ff..48f1ef1c 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -280,18 +280,7 @@ pub fn process_agent_hint(pid: u32) -> Option<crate::detect::Agent> { return None; } let environ = std::fs::read(format!("/proc/{pid}/environ")).ok()?; - parse_agent_env_hint(&environ) -} - -fn parse_agent_env_hint(environ: &[u8]) -> Option<crate::detect::Agent> { - for record in environ.split(|&byte| byte == 0) { - let Some(value) = record.strip_prefix(b"HERDR_AGENT=") else { - continue; - }; - let value = std::str::from_utf8(value).ok()?; - return crate::detect::parse_agent_label(value); - } - None + super::parse_agent_env_hint(&environ) } pub fn session_processes(child_pid: u32) -> Vec<u32> { @@ -809,24 +798,6 @@ mod tests { } #[test] - fn parse_agent_env_hint_accepts_known_agents() { - assert_eq!( - parse_agent_env_hint(b"PATH=/bin\0HERDR_AGENT=claude\0TERM=xterm\0"), - Some(crate::detect::Agent::Claude) - ); - assert_eq!( - parse_agent_env_hint(b"HERDR_AGENT=codex"), - Some(crate::detect::Agent::Codex) - ); - } - - #[test] - fn parse_agent_env_hint_ignores_missing_or_unknown_agents() { - assert_eq!(parse_agent_env_hint(b"PATH=/bin\0TERM=xterm\0"), None); - assert_eq!(parse_agent_env_hint(b"HERDR_AGENT=not-an-agent\0"), None); - } - - #[test] fn clipboard_commands_prefer_wayland_when_available() { let _guard = env_lock().lock().unwrap(); unsafe { |
