Skip to content

Commit

Permalink
Report an error in Execute on tvOS (facebook#1530)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#1530

The body of `Execute` is currently ifdef'd out on tvOS, which includes
the return statement. Instead, return false and report an error when it
is called on tvOS.

Differential Revision: D64090934
  • Loading branch information
neildhar authored and facebook-github-bot committed Oct 9, 2024
1 parent fd5e97c commit 7f00a7c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions external/llvh/lib/Support/Unix/Program.inc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
ArrayRef<StringRef> Args, Optional<ArrayRef<StringRef>> Env,
ArrayRef<Optional<StringRef>> Redirects,
unsigned MemoryLimit, std::string *ErrMsg) {
// fork, exec and posix_spawn are all unavailable on tvOS, so just report an
// error.
#if defined(TARGET_OS_TV) && TARGET_OS_TV
if (ErrMsg)
*ErrMsg = "Executing another program is unsupported on this platform";
return false;
#else
if (!llvh::sys::fs::exists(Program)) {
if (ErrMsg)
*ErrMsg = std::string("Executable \"") + Program.str() +
Expand Down Expand Up @@ -265,9 +272,6 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
}
#endif

// error: 'fork' is unavailable: not available on tvOS
// error: 'execve' is unavailable: not available on tvOS
#if !(defined(TARGET_OS_TV) && TARGET_OS_TV)
// Create a child process.
int child = fork();
switch (child) {
Expand Down

0 comments on commit 7f00a7c

Please sign in to comment.