Preparation for Windows pipe redirection fix

This commit is contained in:
Jack Andersen 2016-09-11 09:52:59 -10:00
parent 8cf06844e6
commit 127343c6d1
2 changed files with 8 additions and 4 deletions

View File

@ -168,6 +168,10 @@ void BlenderConnection::_closePipe()
{ {
close(m_readpipe[0]); close(m_readpipe[0]);
close(m_writepipe[1]); close(m_writepipe[1]);
#ifdef _WIN32
CloseHandle(m_pinfo.hProcess);
CloseHandle(m_pinfo.hThread);
#endif
} }
void BlenderConnection::_blenderDied() void BlenderConnection::_blenderDied()
@ -280,8 +284,7 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
sinfo.dwFlags = STARTF_USESTDHANDLES; sinfo.dwFlags = STARTF_USESTDHANDLES;
} }
PROCESS_INFORMATION pinfo; if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo))
if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &pinfo))
{ {
LPWSTR messageBuffer = nullptr; LPWSTR messageBuffer = nullptr;
size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,

View File

@ -51,9 +51,10 @@ public:
private: private:
bool m_lock = false; bool m_lock = false;
#if _WIN32 #if _WIN32
HANDLE m_blenderProc; HANDLE m_blenderProc = 0;
PROCESS_INFORMATION m_pinfo = {};
#else #else
pid_t m_blenderProc; pid_t m_blenderProc = 0;
#endif #endif
int m_readpipe[2]; int m_readpipe[2];
int m_writepipe[2]; int m_writepipe[2];