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