Fixes the crash for ps --full in Windows (#1514)

* Fixes the crash for `ps --full` in Windows

* Update ps.rs
This commit is contained in:
Jonathan Turner 2020-03-23 08:28:02 +13:00 committed by GitHub
parent 36b5d063c1
commit 53c8185af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,11 +66,14 @@ pub async fn ps(tag: Tag, full: bool) -> Vec<Value> {
dict.insert_untagged("exe", UntaggedValue::string(exe.to_string_lossy()))
}
if let Ok(command) = process.command().await {
dict.insert_untagged(
"command",
UntaggedValue::string(command.to_os_string().to_string_lossy()),
);
#[cfg(not(windows))]
{
if let Ok(command) = process.command().await {
dict.insert_untagged(
"command",
UntaggedValue::string(command.to_os_string().to_string_lossy()),
);
}
}
}
output.push(dict.into_value());