From d2b99010e4b5b4457828d91799649517399d0075 Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Fri, 7 Jan 2022 15:18:45 +0100 Subject: [PATCH] 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. --- Userland/Utilities/jp.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Utilities/jp.cpp b/Userland/Utilities/jp.cpp index 99612c1adb..1523e01254 100644 --- a/Userland/Utilities/jp.cpp +++ b/Userland/Utilities/jp.cpp @@ -36,10 +36,11 @@ ErrorOr serenity_main(Main::Arguments arguments) VERIFY(spaces_in_indent >= 0); args_parser.parse(arguments); + RefPtr 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"));