Remove FreeConsole calls. (#1358)

This commit is contained in:
Justin Kotalik 2018-08-31 08:16:07 -07:00 committed by Pavel Krymets
parent 729a98adfc
commit db01ae3717
4 changed files with 2 additions and 24 deletions

View File

@ -20,8 +20,7 @@ FileOutputManager::FileOutputManager(bool fEnableNativeLogging) :
m_disposed(false),
stdoutWrapper(nullptr),
stderrWrapper(nullptr),
m_fEnableNativeRedirection(fEnableNativeLogging),
m_fCreatedConsole(false)
m_fEnableNativeRedirection(fEnableNativeLogging)
{
InitializeSRWLock(&m_srwLock);
}
@ -61,10 +60,6 @@ FileOutputManager::Start()
RETURN_LAST_ERROR();
}
}
else
{
m_fCreatedConsole = true;
}
// Concatenate the log file name and application path
RETURN_IF_FAILED(FILE_UTILITY::ConvertPathToFullPath(
@ -145,11 +140,6 @@ FileOutputManager::Stop()
m_disposed = true;
if (m_fCreatedConsole)
{
RETURN_LAST_ERROR_IF(!FreeConsole());
}
if (m_hLogFileHandle == INVALID_HANDLE_VALUE)
{
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);

View File

@ -35,7 +35,6 @@ private:
STRA m_straFileContent;
BOOL m_disposed;
BOOL m_fEnableNativeRedirection;
BOOL m_fCreatedConsole;
SRWLOCK m_srwLock{};
std::unique_ptr<StdWrapper> stdoutWrapper;
std::unique_ptr<StdWrapper> stderrWrapper;

View File

@ -24,8 +24,7 @@ PipeOutputManager::PipeOutputManager(bool fEnableNativeLogging) :
m_disposed(FALSE),
m_fEnableNativeRedirection(fEnableNativeLogging),
stdoutWrapper(nullptr),
stderrWrapper(nullptr),
m_fCreatedConsole(false)
stderrWrapper(nullptr)
{
InitializeSRWLock(&m_srwLock);
}
@ -54,10 +53,6 @@ HRESULT PipeOutputManager::Start()
RETURN_LAST_ERROR();
}
}
else
{
m_fCreatedConsole = true;
}
RETURN_LAST_ERROR_IF(!CreatePipe(&hStdErrReadPipe, &hStdErrWritePipe, &saAttr, 0 /*nSize*/));
@ -108,11 +103,6 @@ HRESULT PipeOutputManager::Stop()
m_disposed = true;
if (m_fCreatedConsole)
{
FreeConsole();
}
// Both pipe wrappers duplicate the pipe writer handle
// meaning we are fine to close the handle too.
if (m_hErrWritePipe != INVALID_HANDLE_VALUE)

View File

@ -39,7 +39,6 @@ private:
SRWLOCK m_srwLock {};
BOOL m_disposed;
BOOL m_fEnableNativeRedirection;
BOOL m_fCreatedConsole;
std::unique_ptr<StdWrapper> stdoutWrapper;
std::unique_ptr<StdWrapper> stderrWrapper;
};