From 3526252ff2fd80a459c72ab1c55ea5a6ee61aa2f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 23 Dec 2018 21:04:38 +0000 Subject: swaroop: encrypt decryption private key with motherboard UUID. --- src/lib/cross.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/lib/cross.cc') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index e3fb22f39..171bf2c81 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -474,3 +474,30 @@ home_directory () return boost::filesystem::path(getenv("HOMEDRIVE")) / boost::filesystem::path(getenv("HOMEPATH")); #endif } + +string +command_and_read (string cmd) +{ +#ifdef DCPOMATIC_LINUX + FILE* pipe = popen (cmd.c_str(), "r"); + if (!pipe) { + throw runtime_error ("popen failed"); + } + + string result; + char buffer[128]; + try { + while (fgets(buffer, sizeof(buffer), pipe)) { + result += buffer; + } + } catch (...) { + pclose (pipe); + throw; + } + + pclose (pipe); + return result; +#endif + + return ""; +} -- cgit v1.2.3