summaryrefslogtreecommitdiff
path: root/plugins/New_GPG
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-06-16 16:13:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-06-16 16:13:12 +0300
commit81fc90c33791032f654a0bbb4ac5455cfd92061d (patch)
treea00b4b6d3b7fca9ecca4225029e5227e5a783c6b /plugins/New_GPG
parentad727a136a6b592b14cfaa719ae895c119391044 (diff)
NewGPG: fix for a deadlock in the boost code
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-xplugins/New_GPG/src/gpg_wrapper.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp
index ec61fe129a..985f6e3b82 100755
--- a/plugins/New_GPG/src/gpg_wrapper.cpp
+++ b/plugins/New_GPG/src/gpg_wrapper.cpp
@@ -71,29 +71,20 @@ void pxEexcute_thread(gpg_execution_params *params)
PathToAbsoluteW(L"\\", mir_path);
bp::child *c;
- bp::ipstream perr, pout;
+ std::future<std::string> pout;
+ boost::asio::io_context ios;
if (params->bNoOutput)
- c = new bp::child(bin_path.c_str(), argv, bp::windows::hide);
+ c = new bp::child(bin_path.c_str(), argv, bp::windows::hide, bp::std_in.close(), ios);
else
- c = new bp::child(bin_path.c_str(), argv, bp::windows::hide, bp::std_out > pout, bp::std_err > perr);
+ c = new bp::child(bin_path.c_str(), argv, bp::windows::hide, bp::std_in.close(), bp::std_out > pout, bp::std_err > pout, ios);
params->child = c;
- c->wait();
+ ios.run();
+
if (!params->bNoOutput) {
- std::string s;
- while (!pout.eof()) {
- std::getline(pout, s);
- params->out.Append(s.c_str());
- params->out.Append("\n");
- }
-
- while (!perr.eof()) {
- std::getline(perr, s);
- params->out.Append(s.c_str());
- params->out.Append("\n");
- }
-
+ params->out.Append(pout.get().c_str());
+ params->out.Append("\n");
params->out.Replace("\r\r", "");
if (globals.debuglog)