mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11: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:
parent
e8c71605b9
commit
d2b99010e4
1 changed files with 4 additions and 3 deletions
|
@ -36,10 +36,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
VERIFY(spaces_in_indent >= 0);
|
VERIFY(spaces_in_indent >= 0);
|
||||||
args_parser.parse(arguments);
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
|
RefPtr<Core::File> file;
|
||||||
if (path == nullptr)
|
if (path == nullptr)
|
||||||
path = "/dev/stdin"sv;
|
file = Core::File::standard_input();
|
||||||
|
else
|
||||||
auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
|
file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly));
|
||||||
|
|
||||||
TRY(Core::System::pledge("stdio"));
|
TRY(Core::System::pledge("stdio"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue