gnucash master: Fix quotes on Windows.
John Ralls
jralls at code.gnucash.org
Sun Mar 19 13:32:42 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/576fc9b5 (commit)
from https://github.com/Gnucash/gnucash/commit/90e1e2d1 (commit)
commit 576fc9b52cc2fd7d444c445630d0e91a9b1834ee
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Mar 19 10:28:30 2023 -0700
Fix quotes on Windows.
Boost process wchar_t conversion chokes if it's fed an empty string.
This would happen when the user had no alphavantage key. Separate
the process invocation to not present the empty value to boost process.
diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp
index b0ea470c7a..704460f669 100644
--- a/libgnucash/app-utils/gnc-quotes.cpp
+++ b/libgnucash/app-utils/gnc-quotes.cpp
@@ -211,14 +211,23 @@ GncFQQuoteSource::run_cmd (const StrVec& args, const std::string& json_string) c
boost::asio::io_service svc;
auto input_buf = bp::buffer (json_string);
- bp::child process (c_cmd, args,
- bp::std_out > out_buf,
- bp::std_err > err_buf,
- bp::std_in < input_buf,
- bp::env["ALPHAVANTAGE_API_KEY"]= (m_api_key.empty() ? "" : m_api_key),
- svc);
- svc.run();
- process.wait();
+ bp::child process;
+ if (m_api_key.empty())
+ process = bp::child(c_cmd, args,
+ bp::std_out > out_buf,
+ bp::std_err > err_buf,
+ bp::std_in < input_buf,
+ svc);
+ else
+ process = bp::child(c_cmd, args,
+ bp::std_out > out_buf,
+ bp::std_err > err_buf,
+ bp::std_in < input_buf,
+ bp::env["ALPHAVANTAGE_API_KEY"] = m_api_key,
+ svc);
+
+ svc.run();
+ process.wait();
{
auto raw = out_buf.get();
Summary of changes:
libgnucash/app-utils/gnc-quotes.cpp | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
More information about the gnucash-changes
mailing list