Skip to content

Commit

Permalink
FEXRootFSFetcher: Check if curl is installed and fail before running
Browse files Browse the repository at this point in the history
Before doing anything that requires curl, actually check if it is
installed.
Then instruct the user to install curl before using.

Doesn't try installing curl itself since we don't have a clean way to
execute sudo from potentially GUI.

Fixes #1498
  • Loading branch information
Sonicadvance1 committed Jan 9, 2022
1 parent 285ed8f commit 5a5a498
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Source/Tools/FEXRootFSFetcher/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,19 @@ int main(int argc, char **argv, char **const envp) {
return 0;
}

// Check if curl exists on the host
std::vector<const char*> ExecveArgs = {
"curl",
"-V",
nullptr,
};

int32_t Result = Exec::ExecAndWaitForResponseRedirect(ExecveArgs[0], const_cast<char* const*>(ExecveArgs.data()), -1, -1);
if (Result == -1) {
ExecWithInfo("curl is required to use this tool. Please install curl before using.");
return -1;
}

FEX_CONFIG_OPT(LDPath, ROOTFS);

std::error_code ec;
Expand Down

0 comments on commit 5a5a498

Please sign in to comment.