Remove FreeConsole calls. (#1358)
This commit is contained in:
parent
729a98adfc
commit
db01ae3717
|
|
@ -20,8 +20,7 @@ FileOutputManager::FileOutputManager(bool fEnableNativeLogging) :
|
||||||
m_disposed(false),
|
m_disposed(false),
|
||||||
stdoutWrapper(nullptr),
|
stdoutWrapper(nullptr),
|
||||||
stderrWrapper(nullptr),
|
stderrWrapper(nullptr),
|
||||||
m_fEnableNativeRedirection(fEnableNativeLogging),
|
m_fEnableNativeRedirection(fEnableNativeLogging)
|
||||||
m_fCreatedConsole(false)
|
|
||||||
{
|
{
|
||||||
InitializeSRWLock(&m_srwLock);
|
InitializeSRWLock(&m_srwLock);
|
||||||
}
|
}
|
||||||
|
|
@ -61,10 +60,6 @@ FileOutputManager::Start()
|
||||||
RETURN_LAST_ERROR();
|
RETURN_LAST_ERROR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_fCreatedConsole = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Concatenate the log file name and application path
|
// Concatenate the log file name and application path
|
||||||
RETURN_IF_FAILED(FILE_UTILITY::ConvertPathToFullPath(
|
RETURN_IF_FAILED(FILE_UTILITY::ConvertPathToFullPath(
|
||||||
|
|
@ -145,11 +140,6 @@ FileOutputManager::Stop()
|
||||||
|
|
||||||
m_disposed = true;
|
m_disposed = true;
|
||||||
|
|
||||||
if (m_fCreatedConsole)
|
|
||||||
{
|
|
||||||
RETURN_LAST_ERROR_IF(!FreeConsole());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_hLogFileHandle == INVALID_HANDLE_VALUE)
|
if (m_hLogFileHandle == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ private:
|
||||||
STRA m_straFileContent;
|
STRA m_straFileContent;
|
||||||
BOOL m_disposed;
|
BOOL m_disposed;
|
||||||
BOOL m_fEnableNativeRedirection;
|
BOOL m_fEnableNativeRedirection;
|
||||||
BOOL m_fCreatedConsole;
|
|
||||||
SRWLOCK m_srwLock{};
|
SRWLOCK m_srwLock{};
|
||||||
std::unique_ptr<StdWrapper> stdoutWrapper;
|
std::unique_ptr<StdWrapper> stdoutWrapper;
|
||||||
std::unique_ptr<StdWrapper> stderrWrapper;
|
std::unique_ptr<StdWrapper> stderrWrapper;
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@ PipeOutputManager::PipeOutputManager(bool fEnableNativeLogging) :
|
||||||
m_disposed(FALSE),
|
m_disposed(FALSE),
|
||||||
m_fEnableNativeRedirection(fEnableNativeLogging),
|
m_fEnableNativeRedirection(fEnableNativeLogging),
|
||||||
stdoutWrapper(nullptr),
|
stdoutWrapper(nullptr),
|
||||||
stderrWrapper(nullptr),
|
stderrWrapper(nullptr)
|
||||||
m_fCreatedConsole(false)
|
|
||||||
{
|
{
|
||||||
InitializeSRWLock(&m_srwLock);
|
InitializeSRWLock(&m_srwLock);
|
||||||
}
|
}
|
||||||
|
|
@ -54,10 +53,6 @@ HRESULT PipeOutputManager::Start()
|
||||||
RETURN_LAST_ERROR();
|
RETURN_LAST_ERROR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_fCreatedConsole = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_LAST_ERROR_IF(!CreatePipe(&hStdErrReadPipe, &hStdErrWritePipe, &saAttr, 0 /*nSize*/));
|
RETURN_LAST_ERROR_IF(!CreatePipe(&hStdErrReadPipe, &hStdErrWritePipe, &saAttr, 0 /*nSize*/));
|
||||||
|
|
||||||
|
|
@ -108,11 +103,6 @@ HRESULT PipeOutputManager::Stop()
|
||||||
|
|
||||||
m_disposed = true;
|
m_disposed = true;
|
||||||
|
|
||||||
if (m_fCreatedConsole)
|
|
||||||
{
|
|
||||||
FreeConsole();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both pipe wrappers duplicate the pipe writer handle
|
// Both pipe wrappers duplicate the pipe writer handle
|
||||||
// meaning we are fine to close the handle too.
|
// meaning we are fine to close the handle too.
|
||||||
if (m_hErrWritePipe != INVALID_HANDLE_VALUE)
|
if (m_hErrWritePipe != INVALID_HANDLE_VALUE)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ private:
|
||||||
SRWLOCK m_srwLock {};
|
SRWLOCK m_srwLock {};
|
||||||
BOOL m_disposed;
|
BOOL m_disposed;
|
||||||
BOOL m_fEnableNativeRedirection;
|
BOOL m_fEnableNativeRedirection;
|
||||||
BOOL m_fCreatedConsole;
|
|
||||||
std::unique_ptr<StdWrapper> stdoutWrapper;
|
std::unique_ptr<StdWrapper> stdoutWrapper;
|
||||||
std::unique_ptr<StdWrapper> stderrWrapper;
|
std::unique_ptr<StdWrapper> stderrWrapper;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue