Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix windows login browser launch arguments (#3418)

kt6c695aabee6e
diff --git a/crates/pa-core/src/platform/browser.rs b/crates/pa-core/src/platform/browser.rs
index b0b5a8ccc4..7d9e89a9d5 100644
--- a/crates/pa-core/src/platform/browser.rs
+++ b/crates/pa-core/src/platform/browser.rs
@@ -15,7 +15,7 @@ fn opener(url: &str) -> (&'static str, Vec<String>) {
}
#[cfg(windows)]
-fn opener(url: &str) -> (&'static str, Vec<String>) {
+fn opener(url: &str) -> (String, Vec<String>) {
// Absolute System32 path (the TS dialog resolves it from
// `SystemRoot`, defaulting to `C:\Windows`).
let system_root = std::env::var("SystemRoot").unwrap_or_else(|_| "C:\\Windows".to_string());
@@ -23,12 +23,8 @@ fn opener(url: &str) -> (&'static str, Vec<String>) {
.join("System32")
.join("rundll32.exe");
(
- "rundll32",
- vec![
- rundll32.to_string_lossy().into_owned(),
- "url.dll,FileProtocolHandler".to_string(),
- url.to_string(),
- ],
+ rundll32.to_string_lossy().into_owned(),
+ vec!["url.dll,FileProtocolHandler".to_string(), url.to_string()],
)
}
@@ -56,4 +52,23 @@ mod tests {
assert!(!args.is_empty());
assert!(args.iter().any(|arg| arg.contains("example.com")));
}
+
+ #[cfg(windows)]
+ #[test]
+ fn browser_launch_uses_system32_program_and_dll_entrypoint_arguments() {
+ let url = "https://example.com/login?state=a%20b&code=c";
+ let (program, args) = opener(url);
+ let command = Command::new(&program);
+ let system_root = std::env::var("SystemRoot").unwrap_or_else(|_| "C:\\Windows".to_string());
+ let expected_program = std::path::Path::new(&system_root)
+ .join("System32")
+ .join("rundll32.exe");
+ assert_eq!(
+ (command.get_program(), args),
+ (
+ expected_program.as_os_str(),
+ vec!["url.dll,FileProtocolHandler".to_string(), url.to_string()],
+ )
+ );
+ }
}