serenity/Userland/Utilities/reboot.cpp
Dan Klishch 5ed7cd6e32 Everywhere: Use east const in more places
These changes are compatible with clang-format 16 and will be mandatory
when we eventually bump clang-format version. So, since there are no
real downsides, let's commit them now.
2024-04-19 06:31:19 -04:00

22 lines
534 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/ByteString.h>
#include <LibCore/File.h>
#include <LibMain/Main.h>
ErrorOr<int> serenity_main(Main::Arguments)
{
auto file = TRY(Core::File::open("/sys/kernel/power_state"sv, Core::File::OpenMode::Write));
ByteString const file_contents = "1";
TRY(file->write_until_depleted(file_contents.bytes()));
file->close();
return 0;
}