- more cleanups
This commit is contained in:
parent
18b59691ef
commit
22acd46e30
|
|
@ -107,6 +107,7 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
||||||
char* cmdbuffer = (char*)_alloca(cmdline.size()+1);
|
char* cmdbuffer = (char*)_alloca(cmdline.size()+1);
|
||||||
strcpy(cmdbuffer, StringHelper::replace(cmdline, "/", "\\").c_str());
|
strcpy(cmdbuffer, StringHelper::replace(cmdline, "/", "\\").c_str());
|
||||||
|
|
||||||
|
|
||||||
BOOL fSuccess = CreateProcessA( nullptr, cmdbuffer, nullptr, nullptr, TRUE,
|
BOOL fSuccess = CreateProcessA( nullptr, cmdbuffer, nullptr, nullptr, TRUE,
|
||||||
CREATE_NEW_CONSOLE, nullptr, nullptr, &si, &pi);
|
CREATE_NEW_CONSOLE, nullptr, nullptr, &si, &pi);
|
||||||
if (! fSuccess)
|
if (! fSuccess)
|
||||||
|
|
@ -158,8 +159,20 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
||||||
if (buf[0])
|
if (buf[0])
|
||||||
callback(StringHelper::trim(std::string(buf)));
|
callback(StringHelper::trim(std::string(buf)));
|
||||||
|
|
||||||
|
char ctrlc = 3;
|
||||||
|
//if (finish_flag)
|
||||||
|
// ::WriteFile(hPipeWrite, &ctrlc, 1, nullptr, nullptr);
|
||||||
|
|
||||||
|
// GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, pi.dwProcessId);
|
||||||
|
|
||||||
CloseHandle( hPipeWrite );
|
CloseHandle( hPipeWrite );
|
||||||
CloseHandle( hPipeRead );
|
CloseHandle( hPipeRead );
|
||||||
|
if (finish_flag)
|
||||||
|
{
|
||||||
|
//GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0);
|
||||||
|
// Close underlying process
|
||||||
|
//TerminateProcess(pi.hProcess, 3);
|
||||||
|
}
|
||||||
CloseHandle( pi.hProcess );
|
CloseHandle( pi.hProcess );
|
||||||
CloseHandle( pi.hThread );
|
CloseHandle( pi.hThread );
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue