Execute a command using the shell. Returns true if and only if the command's exit status was 0.
| 33 | // Execute a command using the shell. |
| 34 | // Returns true if and only if the command's exit status was 0. |
| 35 | bool ExecuteCommand(const std::string& command) { |
| 36 | errno = 0; |
| 37 | int status = std::system(command.c_str()); |
| 38 | assert(errno == 0 && "failed to execute command"); |
| 39 | // The result returned by 'system' is implementation-defined, but is |
| 40 | // usually the case that the returned value is 0 when the command's exit |
| 41 | // code was 0. We are assuming that here, and that's all we depend on. |
| 42 | return status == 0; |
| 43 | } |
| 44 | |
| 45 | // Status and actions to perform after parsing command-line arguments. |
| 46 | enum ReduceActions { REDUCE_CONTINUE, REDUCE_STOP }; |