ΒΆint ExecuteAndWait(
    llvm::StringRef Program,
    ArrayRef<llvm::StringRef> Args,
    Optional<ArrayRef<llvm::StringRef>> Env =
        None,
    ArrayRef<Optional<llvm::StringRef>>
        Redirects = {},
    unsigned int SecondsToWait = 0,
    unsigned int MemoryLimit = 0,
    std::string* ErrMsg = nullptr,
    bool* ExecutionFailed = nullptr)

Description

This function executes the program using the arguments provided. The invoked program will inherit the stdin, stdout, and stderr file descriptors, the environment and other configuration settings of the invoking program. This function waits for the program to finish, so should be avoided in library functions that aren't expected to block. Consider using ExecuteNoWait() instead.

Declared at: llvm/include/llvm/Support/Program.h:88

Parameters

llvm::StringRef Program
ArrayRef<llvm::StringRef> Args
Optional<ArrayRef<llvm::StringRef>> Env = None
ArrayRef<Optional<llvm::StringRef>> Redirects = {}
unsigned int SecondsToWait = 0
unsigned int MemoryLimit = 0
std::string* ErrMsg = nullptr
bool* ExecutionFailed = nullptr

Returns

an integer result code indicating the status of the program. A zero or positive value indicates the result code of the program. -1 indicates failure to execute -2 indicates a crash during execution or timeout