wineconsole: Consistently return nonzero exitcode on error.
This commit is contained in:
parent
888ffb1134
commit
29b55a5cae
|
@ -1018,7 +1018,7 @@ static int WCCURSES_MainLoop(struct inner_data* data)
|
|||
|
||||
WCCURSES_Resize(data);
|
||||
|
||||
if (pipe( PRIVATE(data)->sync_pipe ) == -1) return 0;
|
||||
if (pipe( PRIVATE(data)->sync_pipe ) == -1) return 1;
|
||||
PRIVATE(data)->input_thread = CreateThread( NULL, 0, input_thread, data, 0, &id );
|
||||
|
||||
while (!data->dying && WaitForSingleObject(data->hSynchro, INFINITE) == WAIT_OBJECT_0)
|
||||
|
|
|
@ -1382,7 +1382,7 @@ static int WCUSER_MainLoop(struct inner_data* data)
|
|||
* so GetMessage would lead to delayed processing */
|
||||
while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT) return 0;
|
||||
if (msg.message == WM_QUIT) return 1;
|
||||
WINE_TRACE("dispatching msg %04x\n", msg.message);
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
|
|
|
@ -720,7 +720,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
|
|||
*
|
||||
* Spawn the child process when invoked with wineconsole foo bar
|
||||
*/
|
||||
static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine)
|
||||
static int WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine)
|
||||
{
|
||||
PROCESS_INFORMATION info;
|
||||
STARTUPINFOW startup;
|
||||
|
@ -743,20 +743,22 @@ static BOOL WINECON_Spawn(struct inner_data* data, LPWSTR cmdLine)
|
|||
{
|
||||
WINE_ERR("Can't dup handles\n");
|
||||
/* no need to delete handles, we're exiting the program anyway */
|
||||
return FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
done = CreateProcessW(NULL, cmdLine, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info);
|
||||
if (done)
|
||||
{
|
||||
CloseHandle(info.hProcess);
|
||||
CloseHandle(info.hThread);
|
||||
}
|
||||
|
||||
/* we no longer need the handles passed to the child for the console */
|
||||
CloseHandle(startup.hStdInput);
|
||||
CloseHandle(startup.hStdOutput);
|
||||
CloseHandle(startup.hStdError);
|
||||
|
||||
CloseHandle(info.hProcess);
|
||||
CloseHandle(info.hThread);
|
||||
|
||||
return done;
|
||||
return !done;
|
||||
}
|
||||
|
||||
struct wc_init {
|
||||
|
@ -852,9 +854,9 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
|
|||
{
|
||||
case from_event:
|
||||
/* case of wineconsole <evt>, signal process that created us that we're up and running */
|
||||
if (!(data = WINECON_Init(hInst, 0, NULL, wci.backend, nCmdShow))) return 0;
|
||||
ret = SetEvent(wci.event);
|
||||
if (!ret) WINE_ERR("SetEvent failed.\n");
|
||||
if (!(data = WINECON_Init(hInst, 0, NULL, wci.backend, nCmdShow))) return 1;
|
||||
ret = !SetEvent(wci.event);
|
||||
if (ret != 0) WINE_ERR("SetEvent failed.\n");
|
||||
break;
|
||||
case from_process_name:
|
||||
{
|
||||
|
@ -865,30 +867,30 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, INT nCmdSh
|
|||
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (!buffer)
|
||||
return 0;
|
||||
return 1;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, wci.ptr, -1, buffer, len);
|
||||
|
||||
if (!(data = WINECON_Init(hInst, GetCurrentProcessId(), buffer, wci.backend, nCmdShow)))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
ret = WINECON_Spawn(data, buffer);
|
||||
HeapFree(GetProcessHeap(), 0, buffer);
|
||||
if (!ret)
|
||||
if (ret != 0)
|
||||
{
|
||||
WINECON_Delete(data);
|
||||
printf_res(IDS_CMD_LAUNCH_FAILED, wine_dbgstr_a(wci.ptr));
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
if (!ret)
|
||||
{
|
||||
WINE_TRACE("calling MainLoop.\n");
|
||||
ret = data->fnMainLoop(data);
|
||||
|
|
Loading…
Reference in New Issue