1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:17:35 +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

@ -14,7 +14,14 @@
namespace Core {
// If the executed command fails, the returned String will be in the null state.
String command(const String& program, const Vector<String>& arguments, Optional<LexicalPath> chdir);
String command(const String& command_string, Optional<LexicalPath> chdir);
struct CommandResult {
int exit_code { 0 };
String stdout;
String stderr;
};
ErrorOr<CommandResult> command(String const& program, Vector<String> const& arguments, Optional<LexicalPath> chdir);
ErrorOr<CommandResult> command(String const& command_string, Optional<LexicalPath> chdir);
}