From 260ec979bf45846e404d6c1ba4792894f34ec521 Mon Sep 17 00:00:00 2001 From: Alexander Gluzsky Date: Sat, 2 Mar 2013 19:39:56 +0000 Subject: modified: plugins/New_GPG/src/gpg_wrapper.cpp modified: plugins/New_GPG/src/utilities.cpp git-svn-id: http://svn.miranda-ng.org/main/trunk@3853 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/src/gpg_wrapper.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'plugins/New_GPG/src/gpg_wrapper.cpp') diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index bfa359d69a..a031912b4d 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -70,13 +70,15 @@ pxResult pxExecute(std::vector &aargv, string *aoutput, LPDWORD ae pipe pout = create_pipe(); + pipe perr = create_pipe(); { file_descriptor_sink sout(pout.sink, close_handle); + file_descriptor_sink serr(perr.sink, close_handle); char *mir_path = new char [MAX_PATH]; PathToAbsolute("\\", mir_path); - child c = execute(set_args(argv), bind_stdout(sout), /*bind_stdin(sin),*/ show_window(SW_HIDE), hide_console(), inherit_env(), set_env(env), start_in_dir(toUTF16(mir_path))); + child c = execute(set_args(argv), bind_stdout(sout), bind_stderr(serr), close_stdin(),/*bind_stdin(sin),*/ show_window(SW_HIDE), hide_console(), inherit_env(), set_env(env), start_in_dir(toUTF16(mir_path))); _child = &c; delete [] mir_path; @@ -84,7 +86,8 @@ pxResult pxExecute(std::vector &aargv, string *aoutput, LPDWORD ae *aexitcode = ec; _child = nullptr; } - + + file_descriptor_source source(pout.source, close_handle); stream is(source); @@ -102,6 +105,25 @@ pxResult pxExecute(std::vector &aargv, string *aoutput, LPDWORD ae if(bDebugLog) debuglog< is2(source2); + + try{ + std::string s; + while(std::getline(is2, s)) + { + aoutput->append(s); + aoutput->append("\n"); + } + } + catch(const std::exception &e) + { + if(bDebugLog) + debuglog<