mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
kill_process
return true if process doesn't exist
This commit is contained in:
parent
367f06a7f9
commit
1a36743185
|
@ -4149,12 +4149,11 @@ int kill_process(PROCESS process)
|
|||
{
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
BOOL success = TerminateProcess(process, 0);
|
||||
if(success)
|
||||
{
|
||||
CloseHandle(process);
|
||||
}
|
||||
return success;
|
||||
CloseHandle(process);
|
||||
return success || GetLastError() == ERROR_INVALID_HANDLE;
|
||||
#elif defined(CONF_FAMILY_UNIX)
|
||||
if(!is_process_alive(process))
|
||||
return true;
|
||||
int status;
|
||||
kill(process, SIGTERM);
|
||||
return waitpid(process, &status, 0) != -1;
|
||||
|
|
|
@ -137,10 +137,7 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
|||
static CButtonContainer s_LocalServerButton;
|
||||
|
||||
if(!is_process_alive(m_ServerProcess.m_Process))
|
||||
{
|
||||
KillServer();
|
||||
m_ServerProcess.m_Process = INVALID_PROCESS;
|
||||
}
|
||||
|
||||
if(DoButton_Menu(&s_LocalServerButton, m_ServerProcess.m_Process ? Localize("Stop server") : Localize("Run server"), 0, &Button, g_Config.m_ClShowStartMenuImages ? "local_server" : 0, IGraphics::CORNER_ALL, Rounding, 0.5f, vec4(0.0f, 0.0f, 0.0f, 0.5f), m_ServerProcess.m_Process ? vec4(0.0f, 1.0f, 0.0f, 0.25f) : vec4(0.0f, 0.0f, 0.0f, 0.25f)) || (CheckHotKey(KEY_R) && Input()->KeyPress(KEY_R)))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue