diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2020-01-30 12:07:57 +0100 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2020-07-31 13:38:10 +0200 |
commit | 31cf68a3ad1f0a5537c8419e2912b55fbfb88fa0 (patch) | |
tree | a20213743bcc77e030df3fb17f848304aa278a23 /src/util/system.h | |
parent | c17f54ee535faaedf9033717403e1f775b5f1530 (diff) |
[util] add RunCommandParseJSON
Diffstat (limited to 'src/util/system.h')
-rw-r--r-- | src/util/system.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/system.h b/src/util/system.h index 0bd14cc9ea..1df194ca84 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -37,6 +37,8 @@ #include <boost/thread/condition_variable.hpp> // for boost::thread_interrupted +class UniValue; + // Application startup time (used for uptime calculation) int64_t GetStartupTime(); @@ -96,6 +98,16 @@ std::string ShellEscape(const std::string& arg); #if HAVE_SYSTEM void runCommand(const std::string& strCommand); #endif +#ifdef HAVE_BOOST_PROCESS +/** + * Execute a command which returns JSON, and parse the result. + * + * @param str_command The command to execute, including any arguments + * @param str_std_in string to pass to stdin + * @return parsed JSON + */ +UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in=""); +#endif // HAVE_BOOST_PROCESS /** * Most paths passed as configuration arguments are treated as relative to |