ladybird/Userland/Libraries/LibCore/Command.h
Ben Wiederhake f9a24eb7eb LibCore: Migrate Command from Deprecated{File,String}
This gives us free error-propagation in Core::command(...) and
HackStudio::ProjectBuilder::for_each_library_dependencies.

The comment about "String will be in the null state" has been misleading
for a long time, so it is removed.
2023-05-19 23:31:20 +02:00

26 lines
601 B
C++

/*
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteBuffer.h>
#include <AK/LexicalPath.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <spawn.h>
namespace Core {
struct CommandResult {
int exit_code { 0 };
ByteBuffer output;
ByteBuffer error;
};
ErrorOr<CommandResult> command(DeprecatedString const& program, Vector<DeprecatedString> const& arguments, Optional<LexicalPath> chdir);
ErrorOr<CommandResult> command(DeprecatedString const& command_string, Optional<LexicalPath> chdir);
}