[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ISSUE+FIX: 'system' is unavailable: not available on iOS
- From: Sergey Kovalev <kovserg33@...>
- Date: Sat, 16 Nov 2019 23:31:17 +0300
чт, 14 нояб. 2019 г. в 18:34, Bastien Commelongue <b.commelongue@uvi.net>:
> When trying to build lua (5.3) for iOS the following error is generated in loslib.c (l.151) :
> > error: 'system' is unavailable: not available on iOS
>
> Maybe there is a better way to handle this, hopefully this will be considered and help to move LUA library a bit closer to a full iOS / mobile platform support.
You mean something like this?
#include <spawn.h>
extern char **environ;
int isystem(char *cmd) {
pid_t pid; int status;
char *argv[] = {"sh", "-c", cmd, 0};
status = posix_spawn(&pid, "/bin/sh", 0, 0, argv, environ);
if (status == 0) {
if (waitpid(pid, &status, 0) == -1) {
// perror("waitpid");
}
}
return status;
}
#define system(s) isystem(s)