Test get_cmd_line for windows
extern crate sysinfo;
-#[cfg(not(windows))]
use sysinfo::ProcessExt;
use sysinfo::SystemExt;
@@ -37,7 +36,18 @@ fn test_process_refresh() {
#[test]
#[cfg(windows)]
-fn test_get_cmd_line() {}
+fn test_get_cmd_line() {
+ let p = std::process::Command::new("ping")
+ .arg("localhost")
+ .arg("-n")
+ .arg("2")
+ .spawn()
+ .unwrap();
+ let mut s = sysinfo::System::new();
+ s.refresh_processes();
+ let process = s.get_process(p.id() as sysinfo::Pid).unwrap();
+ assert_eq!(process.cmd(), &["ping", "localhost", "-n", "2"]);
+}
#[test]
#[cfg(not(windows))]
