1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:07:45 +00:00

jp: Use File::standard_input() when reading from stdin

Trying to open '/dev/stdin' resulted in ENOENT. Instead use the
standard_input() helper to get the File.
This commit is contained in:
Marcus Nilsson 2022-01-07 15:18:45 +01:00 committed by Brian Gianforcaro
parent e8c71605b9
commit d2b99010e4

View file

@ -36,10 +36,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
VERIFY(spaces_in_indent >= 0);
args_parser.parse(arguments);
RefPtr<Core::File> file;
if (path == nullptr)
path = "/dev/stdin"sv;
auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
file = Core::File::standard_input();
else
file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
TRY(Core::System::pledge("stdio"));