mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
lscpu: Port to Core::Stream
This commit is contained in:
parent
03a3b6f91c
commit
2be7f9f42d
1 changed files with 5 additions and 4 deletions
|
@ -9,7 +9,7 @@
|
|||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Stream.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
||||
|
@ -59,9 +59,10 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
TRY(Core::System::unveil("/sys/kernel/cpuinfo", "r"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto file = TRY(Core::File::open("/sys/kernel/cpuinfo", Core::OpenMode::ReadOnly));
|
||||
auto json = TRY(JsonValue::from_string(file->read_all()));
|
||||
auto& array = json.as_array();
|
||||
auto file = TRY(Core::Stream::File::open("/sys/kernel/cpuinfo"sv, Core::Stream::OpenMode::Read));
|
||||
auto file_contents = TRY(file->read_all());
|
||||
auto json = TRY(JsonValue::from_string(file_contents));
|
||||
auto const& array = json.as_array();
|
||||
|
||||
for (size_t i = 0; i < array.size(); i++) {
|
||||
print_cpu_info(array.at(i).as_object());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue