mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
extcam workarounds: hide console, wait for recorder process to terminate
This commit is contained in:
@@ -55,13 +55,12 @@ piped_proc::piped_proc(std::string cmd)
|
|||||||
siStartInfo.hStdOutput = pipe_wr;
|
siStartInfo.hStdOutput = pipe_wr;
|
||||||
siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
|
siStartInfo.dwFlags |= STARTF_USESTDHANDLES;
|
||||||
|
|
||||||
if (!CreateProcessA(NULL, (char*)cmd.c_str(), NULL, NULL, TRUE, 0, NULL, NULL, &siStartInfo, &process)) {
|
if (!CreateProcessA(NULL, (char*)cmd.c_str(), NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &siStartInfo, &process)) {
|
||||||
ErrorLog("piped_proc: CreateProcess failed!");
|
ErrorLog("piped_proc: CreateProcess failed!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.hProcess)
|
proc_h = process.hProcess;
|
||||||
CloseHandle(process.hProcess);
|
|
||||||
if (process.hThread)
|
if (process.hThread)
|
||||||
CloseHandle(process.hThread);
|
CloseHandle(process.hThread);
|
||||||
}
|
}
|
||||||
@@ -72,6 +71,10 @@ piped_proc::~piped_proc()
|
|||||||
CloseHandle(pipe_wr);
|
CloseHandle(pipe_wr);
|
||||||
if (pipe_rd)
|
if (pipe_rd)
|
||||||
CloseHandle(pipe_rd);
|
CloseHandle(pipe_rd);
|
||||||
|
if (proc_h) {
|
||||||
|
WaitForSingleObject(proc_h, INFINITE);
|
||||||
|
CloseHandle(proc_h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t piped_proc::read(unsigned char *buf, size_t len)
|
size_t piped_proc::read(unsigned char *buf, size_t len)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ private:
|
|||||||
#ifdef __unix__
|
#ifdef __unix__
|
||||||
FILE *file = nullptr;
|
FILE *file = nullptr;
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
|
HANDLE proc_h = nullptr;
|
||||||
HANDLE pipe_rd = nullptr;
|
HANDLE pipe_rd = nullptr;
|
||||||
HANDLE pipe_wr = nullptr;
|
HANDLE pipe_wr = nullptr;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user