aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-07 00:34:53 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-07 16:29:45 +0300
commit52e57507e10ee7cb2869156fb1f00e280e614736 (patch)
tree0c9006a6b315a25f88721c8dbc75fa3a85c4379e /src
parentb5fba2fdd15aa4cab9621c383f72b57644078fd5 (diff)
ci: tighten windows branch validation
Diffstat (limited to 'src')
-rw-r--r--src/pane.rs2
-rw-r--r--src/pane/osc.rs2
-rw-r--r--src/platform/windows.rs12
-rw-r--r--src/server/autodetect.rs2
-rw-r--r--src/server/client_transport.rs25
5 files changed, 32 insertions, 11 deletions
diff --git a/src/pane.rs b/src/pane.rs
index 3861a9a0..32c8c181 100644
--- a/src/pane.rs
+++ b/src/pane.rs
@@ -935,7 +935,7 @@ fn pane_shell_from(configured_shell: &str, env_shell: Option<String>) -> String
#[cfg(windows)]
{
let _ = env_shell;
- return default_pane_shell();
+ default_pane_shell()
}
#[cfg(not(windows))]
diff --git a/src/pane/osc.rs b/src/pane/osc.rs
index 1d37f1c0..23ab433a 100644
--- a/src/pane/osc.rs
+++ b/src/pane/osc.rs
@@ -465,7 +465,7 @@ fn parse_file_uri_cwd(uri: &str) -> Option<PathBuf> {
{
path.remove(0);
}
- return Some(PathBuf::from(path.replace('/', "\\")));
+ Some(PathBuf::from(path.replace('/', "\\")))
}
#[cfg(not(windows))]
diff --git a/src/platform/windows.rs b/src/platform/windows.rs
index a8ad2082..269b3ab2 100644
--- a/src/platform/windows.rs
+++ b/src/platform/windows.rs
@@ -257,7 +257,7 @@ fn session_processes_from_entries(child_pid: u32, entries: &[WindowsProcessEntry
let mut pids = vec![child_pid];
pids.extend(
- descendant_entries(child_pid, &entries)
+ descendant_entries(child_pid, entries)
.into_iter()
.map(|entry| entry.pid),
);
@@ -407,7 +407,7 @@ fn read_process_value<T: Copy>(process: HANDLE, address: *const c_void) -> Optio
}
fn read_unicode_string(process: HANDLE, unicode: UNICODE_STRING) -> Option<String> {
- if unicode.Buffer.is_null() || unicode.Length == 0 || unicode.Length % 2 != 0 {
+ if unicode.Buffer.is_null() || unicode.Length == 0 || !unicode.Length.is_multiple_of(2) {
return None;
}
@@ -445,14 +445,16 @@ mod tests {
let cwd = std::env::temp_dir().join(format!("herdr-cwd-test-{}", std::process::id()));
fs::create_dir_all(&cwd).expect("create cwd fixture");
- let mut child = Command::new("powershell.exe")
- .args(["-NoProfile", "-Command", "Start-Sleep -Seconds 10"])
+ let shell =
+ std::env::var_os("ComSpec").unwrap_or_else(|| r"C:\Windows\System32\cmd.exe".into());
+ let mut child = Command::new(shell)
+ .args(["/D", "/Q", "/C", "ping -n 11 127.0.0.1 > NUL"])
.current_dir(&cwd)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
- .expect("spawn powershell");
+ .expect("spawn cmd");
let deadline = Instant::now() + Duration::from_secs(5);
let mut observed = None;
diff --git a/src/server/autodetect.rs b/src/server/autodetect.rs
index cdba5bd2..f40be988 100644
--- a/src/server/autodetect.rs
+++ b/src/server/autodetect.rs
@@ -55,7 +55,7 @@ fn is_server_listening_at(socket_path: &Path) -> bool {
#[cfg(windows)]
{
let _ = socket_path;
- return read_server_status().ok().flatten().is_some();
+ read_server_status().ok().flatten().is_some()
}
#[cfg(not(windows))]
diff --git a/src/server/client_transport.rs b/src/server/client_transport.rs
index 4f0f12bc..4bbf7bbf 100644
--- a/src/server/client_transport.rs
+++ b/src/server/client_transport.rs
@@ -531,21 +531,40 @@ fn client_read_loop(
mod tests {
use super::*;
use interprocess::local_socket::traits::Listener as _;
+ use std::path::PathBuf;
+
+ struct TestSocketPath(PathBuf);
+
+ impl Drop for TestSocketPath {
+ fn drop(&mut self) {
+ let _ = std::fs::remove_file(&self.0);
+ }
+ }
fn unique_test_path(name: &str) -> std::path::PathBuf {
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos();
- std::env::temp_dir().join(format!("herdr-{name}-{}-{nanos}", std::process::id()))
+ let filename = format!("h{}-{nanos}.sock", std::process::id());
+ #[cfg(unix)]
+ {
+ let _ = name;
+ PathBuf::from("/tmp").join(filename)
+ }
+ #[cfg(windows)]
+ {
+ std::env::temp_dir().join(format!("herdr-{name}-{filename}"))
+ }
}
- fn local_stream_pair(name: &str) -> (LocalStream, LocalStream, std::path::PathBuf) {
+ fn local_stream_pair(name: &str) -> (LocalStream, LocalStream, TestSocketPath) {
let path = unique_test_path(name);
+ let _ = std::fs::remove_file(&path);
let listener = crate::ipc::bind_local_listener(&path).unwrap();
let client = crate::ipc::connect_local_stream(&path).unwrap();
let server = listener.accept().unwrap();
- (client, server, path)
+ (client, server, TestSocketPath(path))
}
#[test]