Don't create std log file for out of process when logs are disabled (#640)

This commit is contained in:
Justin Kotalik 2018-03-07 16:12:50 -08:00 committed by GitHub
parent 419ae06935
commit 4eea754dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 16 deletions

View File

@ -980,6 +980,14 @@ SERVER_PROCESS::SetupStdHandles(
DBG_ASSERT(pStartupInfo);
if (!m_fStdoutLogEnabled)
{
pStartupInfo->dwFlags = STARTF_USESTDHANDLES;
pStartupInfo->hStdInput = INVALID_HANDLE_VALUE;
pStartupInfo->hStdError = INVALID_HANDLE_VALUE;
pStartupInfo->hStdOutput = INVALID_HANDLE_VALUE;
return hr;
}
if (m_hStdoutHandle != NULL && m_hStdoutHandle != INVALID_HANDLE_VALUE)
{
if (!CloseHandle(m_hStdoutHandle))
@ -1038,22 +1046,12 @@ SERVER_PROCESS::SetupStdHandles(
goto Finished;
}
if (m_fStdoutLogEnabled)
{
pStartupInfo->dwFlags = STARTF_USESTDHANDLES;
pStartupInfo->hStdInput = INVALID_HANDLE_VALUE;
pStartupInfo->hStdError = m_hStdoutHandle;
pStartupInfo->hStdOutput = m_hStdoutHandle;
// start timer to open and close handles regularly.
m_Timer.InitializeTimer(STTIMER::TimerCallback, &m_struFullLogFile, 3000, 3000);
}
else
{ // only enable stderr
pStartupInfo->dwFlags = STARTF_USESTDHANDLES;
pStartupInfo->hStdInput = INVALID_HANDLE_VALUE;
pStartupInfo->hStdError = m_hStdoutHandle;
pStartupInfo->hStdOutput = INVALID_HANDLE_VALUE;
}
pStartupInfo->dwFlags = STARTF_USESTDHANDLES;
pStartupInfo->hStdInput = INVALID_HANDLE_VALUE;
pStartupInfo->hStdError = m_hStdoutHandle;
pStartupInfo->hStdOutput = m_hStdoutHandle;
// start timer to open and close handles regularly.
m_Timer.InitializeTimer(STTIMER::TimerCallback, &m_struFullLogFile, 3000, 3000);
Finished:
if (FAILED(hr))