mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
Utilities/w: Port to Core::Stream
This commit is contained in:
parent
8d798c2716
commit
fde9cba2a0
1 changed files with 4 additions and 3 deletions
|
@ -7,8 +7,8 @@
|
|||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <pwd.h>
|
||||
|
@ -25,8 +25,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
TRY(Core::System::unveil("/sys/kernel/processes", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto file = TRY(Core::File::open("/var/run/utmp", Core::OpenMode::ReadOnly));
|
||||
auto json = TRY(JsonValue::from_string(file->read_all()));
|
||||
auto file = TRY(Core::Stream::File::open("/var/run/utmp"sv, Core::Stream::OpenMode::Read));
|
||||
auto file_contents = TRY(file->read_all());
|
||||
auto json = TRY(JsonValue::from_string(file_contents));
|
||||
if (!json.is_object()) {
|
||||
warnln("Error: Could not parse /var/run/utmp");
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue