From f1c40701b517d7656d399b2950a7caebb851097e Mon Sep 17 00:00:00 2001 From: headshot2017 Date: Tue, 6 Apr 2021 21:59:58 -0400 Subject: [PATCH] ugh windows --- src/game/server/gamecontext.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 0b071c0..330cc15 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -849,7 +849,11 @@ void* OnPipe(void *pUserData) else { if (not pSelf->pipe) break; +#if defined(CONF_FAMILY_WINDOWS) _pclose(pipe); +#else + pclose(pipe); +#endif pSelf->pipe = NULL; break; } @@ -2425,13 +2429,21 @@ void CGameContext::ConWindows(IConsole::IResult *pResult, void *pUserData) pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "a command is already running. do \"shell 0 stop\" to interrupt it."); else { +#if defined(CONF_FAMILY_WINDOWS) _pclose(pSelf->pipe); +#else + pclose(pSelf->pipe); +#endif pSelf->pipe = NULL; pSelf->SendChat(-1, CGameContext::CHAT_ALL, "command interrupted."); } return; } +#if defined(CONF_FAMILY_WINDOWS) if (not (pSelf->pipe = _popen(cmd, "r"))) pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "failed to execute shell command"); +#else + if (not (pSelf->pipe = popen(cmd, "r"))) pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "failed to execute shell command"); +#endif pSelf->shellBroadcast = broadcast; pthread_t jm;