summaryrefslogtreecommitdiff
path: root/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'options.cpp')
-rw-r--r--options.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/options.cpp b/options.cpp
index 70ffc24..f902d59 100644
--- a/options.cpp
+++ b/options.cpp
@@ -216,12 +216,25 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ptmp = mir_a2t(tmp);
cmd += ptmp;
mir_free(ptmp);
- if(pxExecute(&cmd, "", &output,&exitcode) == pxNotFound)
- {
- MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
+ gpg_execution_params params;
+ pxResult result;
+ params.cmd = &cmd;
+ params.useless = "";
+ params.out = &output;
+ params.code = &exitcode;
+ params.result = &result;
+ HANDLE gpg_thread = mir_forkthread(pxEexcute_thread, (void*)&params);
+ if(WaitForSingleObject(gpg_thread, 10000) == WAIT_TIMEOUT)
+ {
+ TerminateThread(gpg_thread, 0);
+ MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ }
+ if(result == pxNotFound)
+ {
+ MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
mir_free(tmp);
break;
- }
+ }
if(output.find("--delete-secret-keys") != string::npos)
MessageBoxA(0, "we have secret key for this public key, do not removing from GPG keyring", "info", MB_OK);
else
@@ -588,11 +601,24 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP
cmd += _T(" --import \"");
cmd += tmp2;
cmd += _T("\"");
- }
- if(pxExecute(&cmd, "", &output, &exitcode) == pxNotFound)
- {
+ }
+ gpg_execution_params params;
+ pxResult result;
+ params.cmd = &cmd;
+ params.useless = "";
+ params.out = &output;
+ params.code = &exitcode;
+ params.result = &result;
+ HANDLE gpg_thread = mir_forkthread(pxEexcute_thread, (void*)&params);
+ if(WaitForSingleObject(gpg_thread, 10000) == WAIT_TIMEOUT)
+ {
+ TerminateThread(gpg_thread, 0);
+ MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ }
+ if(result == pxNotFound)
+ {
MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
- break;
+ break;
}
mir_free(begin);
mir_free(end);