| 28 | using util::ReplaceAll; |
| 29 | |
| 30 | static void AlertNotify(const std::string& strMessage) |
| 31 | { |
| 32 | #if HAVE_SYSTEM |
| 33 | std::string strCmd = gArgs.GetArg("-alertnotify", ""); |
| 34 | if (strCmd.empty()) return; |
| 35 | |
| 36 | // Alert text should be plain ascii coming from a trusted source, but to |
| 37 | // be safe we first strip anything not in safeChars, then add single quotes around |
| 38 | // the whole string before passing it to the shell: |
| 39 | std::string singleQuote("'"); |
| 40 | std::string safeStatus = SanitizeString(strMessage); |
| 41 | safeStatus = singleQuote+safeStatus+singleQuote; |
| 42 | ReplaceAll(strCmd, "%s", safeStatus); |
| 43 | |
| 44 | std::thread t(runCommand, strCmd); |
| 45 | t.detach(); // thread runs free |
| 46 | #endif |
| 47 | } |
| 48 | |
| 49 | namespace node { |
| 50 |
no test coverage detected