1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

LibCore: Make Core::command return CommandResult struct

Previously, Core::command only returned a String which contained the
data from stdout.

The CommandResult struct contains the exit code as well as the data
from stdout and stderr.
This commit is contained in:
Itamar 2022-01-07 16:17:19 +02:00 committed by Andreas Kling
parent a4e2d93aa2
commit fbdd6df185
3 changed files with 28 additions and 19 deletions

View file

@ -80,7 +80,10 @@ String GitRepo::command(Vector<String> const& command_parts) const
String GitRepo::command_wrapper(Vector<String> const& command_parts, String const& chdir)
{
return Core::command("git", command_parts, LexicalPath(chdir));
auto result = Core::command("git", command_parts, LexicalPath(chdir));
if (result.is_error() || result.value().exit_code != 0)
return {};
return result.value().stdout;
}
bool GitRepo::git_is_installed()