diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-12-23 21:04:38 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-12-23 21:04:49 +0000 |
| commit | 3526252ff2fd80a459c72ab1c55ea5a6ee61aa2f (patch) | |
| tree | c9e9774de4acfa562f83db39a900fe4d0b241945 /src/lib/cross.cc | |
| parent | a65efe6bd00fbba4f075c4c666dafafb8a5eed4d (diff) | |
swaroop: encrypt decryption private key with motherboard UUID.
Diffstat (limited to 'src/lib/cross.cc')
| -rw-r--r-- | src/lib/cross.cc | 27 |
1 files changed, 27 insertions, 0 deletions
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 ""; +} |
