From 4674577d80e9b11f7311b1ad88e1ec45a0313591 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 27 Mar 2022 15:26:32 -0700 Subject: [PATCH] Everywhere: Rename CommandResult stdout, stderr members to output, error The names stdout / stderr are bound to conflict with existing declarations when compiling against other LibC's. The build on OpenBSD is broken for this reason at the moment. Lets rename the members to more generic names to resolve the situation. --- Userland/DevTools/HackStudio/Git/GitRepo.cpp | 2 +- Userland/DevTools/HackStudio/ProjectBuilder.cpp | 4 ++-- Userland/Libraries/LibCore/Command.cpp | 6 +++--- Userland/Libraries/LibCore/Command.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Userland/DevTools/HackStudio/Git/GitRepo.cpp b/Userland/DevTools/HackStudio/Git/GitRepo.cpp index aee1ac9b6be..d0109ce0f33 100644 --- a/Userland/DevTools/HackStudio/Git/GitRepo.cpp +++ b/Userland/DevTools/HackStudio/Git/GitRepo.cpp @@ -83,7 +83,7 @@ String GitRepo::command_wrapper(Vector const& command_parts, String cons auto result = Core::command("git", command_parts, LexicalPath(chdir)); if (result.is_error() || result.value().exit_code != 0) return {}; - return result.value().stdout; + return result.value().output; } bool GitRepo::git_is_installed() diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.cpp b/Userland/DevTools/HackStudio/ProjectBuilder.cpp index c4ca40d33b4..22cfdbdebae 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.cpp +++ b/Userland/DevTools/HackStudio/ProjectBuilder.cpp @@ -193,7 +193,7 @@ void ProjectBuilder::for_each_library_definition(Function } static const Regex parse_library_definition(R"~~~(.+:serenity_lib[c]?\((\w+) (\w+)\).*)~~~"); - for (auto& line : res.value().stdout.split('\n')) { + for (auto& line : res.value().output.split('\n')) { RegexResult result; if (!parse_library_definition.search(line, result)) continue; @@ -220,7 +220,7 @@ void ProjectBuilder::for_each_library_dependencies(Function parse_library_definition(R"~~~(.+:target_link_libraries\((\w+) ([\w\s]+)\).*)~~~"); - for (auto& line : res.value().stdout.split('\n')) { + for (auto& line : res.value().output.split('\n')) { RegexResult result; if (!parse_library_definition.search(line, result)) diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp index b1e3a9e9de1..25e48425a65 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -80,8 +80,8 @@ ErrorOr command(String const& program, Vector const& argu } return String::copy(result_file->read_all()); }; - auto stdout = read_all_from_pipe(stdout_pipe); - auto stderr = read_all_from_pipe(stderr_pipe); + auto output = read_all_from_pipe(stdout_pipe); + auto error = read_all_from_pipe(stderr_pipe); int wstatus { 0 }; waitpid(pid, &wstatus, 0); @@ -94,7 +94,7 @@ ErrorOr command(String const& program, Vector const& argu # endif } - return CommandResult { WEXITSTATUS(wstatus), stdout, stderr }; + return CommandResult { WEXITSTATUS(wstatus), output, error }; } #endif diff --git a/Userland/Libraries/LibCore/Command.h b/Userland/Libraries/LibCore/Command.h index 8a19986c377..a3680a59625 100644 --- a/Userland/Libraries/LibCore/Command.h +++ b/Userland/Libraries/LibCore/Command.h @@ -17,8 +17,8 @@ namespace Core { struct CommandResult { int exit_code { 0 }; - String stdout; - String stderr; + String output; + String error; }; ErrorOr command(String const& program, Vector const& arguments, Optional chdir);