Restructured the system() fallback to be usable for C and C++

This commit is contained in:
Robert Osfield
2018-01-21 12:09:49 +00:00
parent 9cc2bab737
commit 18d5a9159f
10 changed files with 59 additions and 33 deletions

View File

@@ -19,7 +19,7 @@
#include "lauxlib.h"
#include "lualib.h"
#include <osg/Config>
#include <osg/os_utils>
/*
** list of valid conversion specifiers for the 'strftime' function
@@ -80,18 +80,14 @@
static int os_execute (lua_State *L) {
#if defined(OSG_SYSTEM_SUPPORTED)
const char *cmd = luaL_optstring(L, 1, NULL);
int stat = system(cmd);
int stat = osg_system(cmd);
if (cmd != NULL)
return luaL_execresult(L, stat);
else {
lua_pushboolean(L, stat); /* true if there is a shell */
return 1;
}
#else
return 0;
#endif
}