This way is not safety.
Signed-off-by: Frank Li <lznuaa@gmail.com>
DWORD dwFlags = pEnv ? CREATE_UNICODE_ENVIRONMENT : 0;\r
\r
//DETACHED_PROCESS make ssh recognize that it has no console to launch askpass to input password. \r
- dwFlags |= DETACHED_PROCESS; \r
+ dwFlags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP; \r
+\r
+ memset(&this->m_CurrentGitPi,0,sizeof(PROCESS_INFORMATION));\r
\r
if(!CreateProcess(NULL,(LPWSTR)cmd.GetString(), NULL,NULL,TRUE,dwFlags,pEnv,(LPWSTR)m_CurrentDir.GetString(),&si,&pi))\r
{\r
return GIT_ERROR_CREATE_PROCESS;\r
}\r
\r
+ m_CurrentGitPi = pi;\r
+ \r
CloseHandle(hWrite);\r
if(piOut)\r
*piOut=pi;\r
static CString ms_LastMsysGitDir; // the last msysgitdir added to the path, blank if none\r
static int m_LogEncode;\r
// static CString m_MsysGitPath;\r
+ \r
+ PROCESS_INFORMATION m_CurrentGitPi;\r
+\r
CGit(void);\r
~CGit(void);\r
\r
CString url;\r
url=dlg.m_RemoteURL;\r
CString cmd;\r
- cmd.Format(_T("git.exe fetch \"%s\" %s"),url, dlg.m_RemoteBranchName);\r
+ cmd.Format(_T("git.exe fetch -v \"%s\" %s"),url, dlg.m_RemoteBranchName);\r
CProgressDlg progress;\r
\r
if(!dlg.m_bRebase)\r
CString cmdRebase;\r
if(dlg.m_bRebase)\r
cmdRebase = "--rebase ";\r
- cmd.Format(_T("git.exe pull %s\"%s\" %s"),cmdRebase, url, dlg.m_RemoteBranchName);\r
+ cmd.Format(_T("git.exe pull -v %s\"%s\" %s"),cmdRebase, url, dlg.m_RemoteBranchName);\r
CProgressDlg progress;\r
progress.m_GitCmd = cmd;\r
progress.m_bAutoCloseOnSuccess = true;\r
}\r
void CProgressDlg::OnCancel()\r
{\r
+ m_bAbort = true;\r
if(m_bDone)\r
{\r
CResizableStandAloneDialog::OnCancel();\r
return;\r
}\r
+\r
+ if( g_Git.m_CurrentGitPi.hProcess )\r
+ {\r
+ if(::GenerateConsoleCtrlEvent(CTRL_C_EVENT,0))\r
+ {\r
+ ::WaitForSingleObject(g_Git.m_CurrentGitPi.hProcess ,10000);\r
+ }else\r
+ {\r
+ int error=::GetLastError();\r
+ }\r
+\r
+ HANDLE hProcessHandle = ::OpenProcess( PROCESS_TERMINATE, FALSE,g_Git.m_CurrentGitPi.dwProcessId);\r
+ if( hProcessHandle )\r
+ if(!::TerminateProcess(hProcessHandle,-1) )\r
+ {\r
+ int error =::GetLastError();\r
+ }\r
+ }\r
\r
- m_bAbort = true;\r
+ ::WaitForSingleObject(g_Git.m_CurrentGitPi.hProcess ,10000);\r
+ CResizableStandAloneDialog::OnCancel();\r
+\r
}\r
\r
void CProgressDlg::InsertCRLF()\r