Serenity Operating System
1/*
2 * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <AK/DeprecatedString.h>
10#include <AK/LexicalPath.h>
11#include <AK/Optional.h>
12#include <spawn.h>
13
14namespace Core {
15
16// If the executed command fails, the returned String will be in the null state.
17
18struct CommandResult {
19 int exit_code { 0 };
20 DeprecatedString output;
21 DeprecatedString error;
22};
23
24ErrorOr<CommandResult> command(DeprecatedString const& program, Vector<DeprecatedString> const& arguments, Optional<LexicalPath> chdir);
25ErrorOr<CommandResult> command(DeprecatedString const& command_string, Optional<LexicalPath> chdir);
26
27}