Repository: imsnif/bandwhich (language: rust)

Issue:
Build failure on Windows
```
   Compiling sysinfo v0.31.2
error[E0061]: this method takes 1 argument but 0 arguments were supplied
   --> src\os\windows.rs:16:13
    |
16  |     sysinfo.refresh_processes();
    |             ^^^^^^^^^^^^^^^^^-- argument #1 of type `ProcessesToUpdate<'_>` is missing
    |
note: method defined here
   --> C:\Users\ךינשגכהד\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.31.2\src\common\system.rs:287:12
    |
287 |     pub fn refresh_processes(&mut self, processes_to_update: ProcessesT...
    |            ^^^^^^^^^^^^^^^^^
help: provide the argument
    |
16  |     sysinfo.refresh_processes(/* ProcessesToUpdate<'_> */);
    |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
  --> src\os\windows.rs:28:43
   |
28 |                 .map(|p| ProcessInfo::new(p.name(), p.pid().as_u32()))
   |                          ---------------- ^^^^^^^^ expected `&str`, found `&OsStr`
   |                          |
   |                          arguments to this function are incorrect
   |
   = note: expected reference `&str`
              found reference `&std::ffi::OsStr`
note: associated function defined here
  --> src\os\shared.rs:30:12
   |
30 |     pub fn new(name: &str, pid: u32) -> Self {
   |            ^^^ ----------

Some errors have detailed explanations: E0061, E0308.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `bandwhich` (bin "bandwhich") due to 2 previous errors
error: failed to compile `bandwhich v0.22.2 (https://github.com/imsnif/bandwhich#4dba5634)`, intermediate artifacts can be found at `C:\Users\0BAC~1\AppData\Local\Temp\cargo-installmJLu9n`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
```


Discussion / hints:

Fix patch:
diff --git a/src/os/windows.rs b/src/os/windows.rs
index 620a4bad..e14b33c2 100644
--- a/src/os/windows.rs
+++ b/src/os/windows.rs
@@ -1,7 +1,7 @@
 use std::collections::HashMap;
 
 use netstat2::*;
-use sysinfo::{Pid, System};
+use sysinfo::{Pid, ProcessesToUpdate, System};
 
 use crate::{
     network::{LocalSocket, Protocol},
@@ -13,7 +13,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets {
     let mut open_sockets = HashMap::new();
 
     let mut sysinfo = System::new_all();
-    sysinfo.refresh_processes();
+    sysinfo.refresh_processes(ProcessesToUpdate::All);
 
     let af_flags = AddressFamilyFlags::IPV4 | AddressFamilyFlags::IPV6;
     let proto_flags = ProtocolFlags::TCP | ProtocolFlags::UDP;
@@ -25,7 +25,7 @@ pub(crate) fn get_open_sockets() -> OpenSockets {
                 .associated_pids
                 .into_iter()
                 .find_map(|pid| sysinfo.process(Pid::from_u32(pid)))
-                .map(|p| ProcessInfo::new(p.name(), p.pid().as_u32()))
+                .map(|p| ProcessInfo::new(&p.name().to_string_lossy(), p.pid().as_u32()))
                 .unwrap_or_default();
 
             match si.protocol_socket_info {


Test patch: