2020-09-15 15:45:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-09-15 15:45:21 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/LexicalPath.h>
|
|
|
|
|
#include <AK/Optional.h>
|
|
|
|
|
#include <AK/String.h>
|
|
|
|
|
#include <spawn.h>
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
|
|
// If the executed command fails, the returned String will be in the null state.
|
2022-01-07 11:17:19 -03:00
|
|
|
|
|
|
|
|
struct CommandResult {
|
|
|
|
|
int exit_code { 0 };
|
2022-03-27 19:26:32 -03:00
|
|
|
String output;
|
|
|
|
|
String error;
|
2022-01-07 11:17:19 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ErrorOr<CommandResult> command(String const& program, Vector<String> const& arguments, Optional<LexicalPath> chdir);
|
|
|
|
|
ErrorOr<CommandResult> command(String const& command_string, Optional<LexicalPath> chdir);
|
2020-09-15 15:45:21 -03:00
|
|
|
|
|
|
|
|
}
|