From f67c6aa7769f96d462daab6ea57b5a429ea9b6ef Mon Sep 17 00:00:00 2001 From: mark Date: Sun, 29 Jan 2006 05:48:38 +0000 Subject: [PATCH] oops, stupid bug. --- w32api/ex.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/w32api/ex.c b/w32api/ex.c index fde33b2..f83201f 100755 --- a/w32api/ex.c +++ b/w32api/ex.c @@ -12,6 +12,8 @@ #include #include +#define debug(...) fprintf(stderr,__VA_ARGS__) + /* Generally useful function -- what luaL_checkudata() should do */ static void *luaL_checkuserdata(lua_State *L, int idx, const char *tname) @@ -409,7 +411,7 @@ static int ex_spawn(lua_State *L) /* XXX does CreateProcess modify its environment argument? */ cmdline = strdup(cmdline); if (environment) environment = strdup(environment); - fprintf(stderr, "CreateProcess(%s)\n", cmdline); + debug("CreateProcess(%s)\n", cmdline); ret = CreateProcess(0, (char *)cmdline, 0, 0, 0, 0, (char *)environment, 0, &si, &pi); // if (environment) free((char *)environment); // free((char *)cmdline); @@ -424,7 +426,7 @@ static int ex_spawn(lua_State *L) static int process_wait(lua_State *L) { struct process *p = luaL_checkuserdata(L, 1, PROCESS_HANDLE); - if (p->status != -1) { + if (p->status == -1) { DWORD exitcode; WaitForSingleObject(p->hProcess, INFINITE); GetExitCodeProcess(p->hProcess, &exitcode);