mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
Utilities/lsof: Propagate errors in JSON decoding
This commit is contained in:
parent
fe2ade13e9
commit
904c8634eb
1 changed files with 6 additions and 1 deletions
|
@ -70,7 +70,12 @@ static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
|||
}
|
||||
auto data = file.value()->read_all();
|
||||
|
||||
auto json = JsonValue::from_string(data).release_value_but_fixme_should_propagate_errors();
|
||||
auto json_or_error = JsonValue::from_string(data);
|
||||
if (json_or_error.is_error()) {
|
||||
outln("lsof: {}", json_or_error.error());
|
||||
return Vector<OpenFile>();
|
||||
}
|
||||
auto json = json_or_error.release_value();
|
||||
|
||||
Vector<OpenFile> files;
|
||||
json.as_array().for_each([pid, &files](const JsonValue& object) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue