From d5c13a3cbc85b4a21272e0982aec9b3b3d81a33d Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 13 May 2023 01:10:30 +0200 Subject: [PATCH] LibCore: Remove standard I/O from DeprecatedFile --- Userland/Libraries/LibCore/DeprecatedFile.cpp | 31 ------------------- Userland/Libraries/LibCore/DeprecatedFile.h | 4 --- 2 files changed, 35 deletions(-) diff --git a/Userland/Libraries/LibCore/DeprecatedFile.cpp b/Userland/Libraries/LibCore/DeprecatedFile.cpp index 61853b6a28..b69b05747d 100644 --- a/Userland/Libraries/LibCore/DeprecatedFile.cpp +++ b/Userland/Libraries/LibCore/DeprecatedFile.cpp @@ -242,37 +242,6 @@ ErrorOr DeprecatedFile::read_link(DeprecatedString const& link #endif -static RefPtr stdin_file; -static RefPtr stdout_file; -static RefPtr stderr_file; - -NonnullRefPtr DeprecatedFile::standard_input() -{ - if (!stdin_file) { - stdin_file = DeprecatedFile::construct(); - stdin_file->open(STDIN_FILENO, OpenMode::ReadOnly, ShouldCloseFileDescriptor::No); - } - return *stdin_file; -} - -NonnullRefPtr DeprecatedFile::standard_output() -{ - if (!stdout_file) { - stdout_file = DeprecatedFile::construct(); - stdout_file->open(STDOUT_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No); - } - return *stdout_file; -} - -NonnullRefPtr DeprecatedFile::standard_error() -{ - if (!stderr_file) { - stderr_file = DeprecatedFile::construct(); - stderr_file->open(STDERR_FILENO, OpenMode::WriteOnly, ShouldCloseFileDescriptor::No); - } - return *stderr_file; -} - static DeprecatedString get_duplicate_name(DeprecatedString const& path, int duplicate_count) { if (duplicate_count == 0) { diff --git a/Userland/Libraries/LibCore/DeprecatedFile.h b/Userland/Libraries/LibCore/DeprecatedFile.h index df4fb8e513..e310e4cf1b 100644 --- a/Userland/Libraries/LibCore/DeprecatedFile.h +++ b/Userland/Libraries/LibCore/DeprecatedFile.h @@ -82,10 +82,6 @@ public: bool open(int fd, OpenMode, ShouldCloseFileDescriptor); [[nodiscard]] int leak_fd(); - static NonnullRefPtr standard_input(); - static NonnullRefPtr standard_output(); - static NonnullRefPtr standard_error(); - static Optional resolve_executable_from_environment(StringView filename); private: