diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 00:34:53 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-07 16:29:45 +0300 |
| commit | 52e57507e10ee7cb2869156fb1f00e280e614736 (patch) | |
| tree | 0c9006a6b315a25f88721c8dbc75fa3a85c4379e /src/platform | |
| parent | b5fba2fdd15aa4cab9621c383f72b57644078fd5 (diff) | |
ci: tighten windows branch validation
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/windows.rs | 12 |
1 files changed, 7 insertions, 5 deletions
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; |
