| 4196 | |
| 4197 | |
| 4198 | std::pair<int, std::string> RunProcess( const char* commandLine ) |
| 4199 | { |
| 4200 | s_fileMutex.lock(); |
| 4201 | #ifdef _WIN32 |
| 4202 | FILE* process = _popen( commandLine, "r" ); |
| 4203 | #else |
| 4204 | FILE* process = popen( commandLine, "r" ); |
| 4205 | #endif |
| 4206 | s_fileMutex.unlock(); |
| 4207 | |
| 4208 | if( !process ) |
| 4209 | { |
| 4210 | return std::make_pair( -1, "" ); |
| 4211 | } |
| 4212 | std::string output; |
| 4213 | char readBuffer[128]; |
| 4214 | while( fgets( readBuffer, sizeof( readBuffer ), process ) ) |
| 4215 | { |
| 4216 | output += readBuffer; |
| 4217 | } |
| 4218 | #ifdef _WIN32 |
| 4219 | return std::make_pair( _pclose( process ), output ); |
| 4220 | #else |
| 4221 | return std::make_pair( pclose( process ), output ); |
| 4222 | #endif |
| 4223 | } |
| 4224 | |
| 4225 | template <typename T> |
| 4226 | void SplitString( const std::string& string, char delim, T callback ) |
no outgoing calls
no test coverage detected