|
|
| |
static string read_output( const char *command ) | static string read_output( const char *command ) |
{ | { |
FILE *f = popen( command, "rt" ); |
FILE *f = popen( command, "r" ); |
string output; | string output; |
if ( !f ) { | if ( !f ) { |
log_error() << "no pipe " << strerror( errno ) << endl; | log_error() << "no pipe " << strerror( errno ) << endl; |
|
|
buffer[bytes] = 0; | buffer[bytes] = 0; |
output += buffer; | output += buffer; |
} | } |
|
|
pclose( f ); | pclose( f ); |
return output; |
// get rid of the endline |
|
return output.substr(0, output.length()-1); |
} | } |
| |
static int create_native() | static int create_native() |