Skip to content

Commit

Permalink
ugh windows
Browse files Browse the repository at this point in the history
  • Loading branch information
headshot2017 committed Apr 7, 2021
1 parent fe70742 commit f1c4070
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/game/server/gamecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f1c4070

Please sign in to comment.