Fixed string quoting on windows in system.exec()
This commit is contained in:
parent
6b39fb6dfb
commit
35ce3d32a9
|
@ -335,10 +335,10 @@ static int f_sleep(lua_State *L) {
|
|||
static int f_exec(lua_State *L) {
|
||||
size_t len;
|
||||
const char *cmd = luaL_checklstring(L, 1, &len);
|
||||
char *buf = malloc(len + 16);
|
||||
char *buf = malloc(len + 32);
|
||||
if (!buf) { luaL_error(L, "buffer allocation failed"); }
|
||||
#if _WIN32
|
||||
sprintf(buf, "cmd /c %s", cmd);
|
||||
sprintf(buf, "cmd /c \"%s\"", cmd);
|
||||
WinExec(buf, SW_HIDE);
|
||||
#else
|
||||
sprintf(buf, "%s &", cmd);
|
||||
|
|
Loading…
Reference in a new issue