Return true on success, false otherwise.
| 91 | |
| 92 | // Return true on success, false otherwise. |
| 93 | bool ExecuteCommand(const Command &Cmd, std::string *CmdOutput) { |
| 94 | FILE *Pipe = popen(Cmd.toString().c_str(), "r"); |
| 95 | if (!Pipe) |
| 96 | return false; |
| 97 | |
| 98 | if (CmdOutput) { |
| 99 | char TmpBuffer[128]; |
| 100 | while (fgets(TmpBuffer, sizeof(TmpBuffer), Pipe)) |
| 101 | CmdOutput->append(TmpBuffer); |
| 102 | } |
| 103 | return pclose(Pipe) == 0; |
| 104 | } |
| 105 | |
| 106 | void SetTimer(int Seconds) { |
| 107 | struct itimerval T { |