Commit 51b662b0 authored by Ruslan Kabatsayev's avatar Ruslan Kabatsayev
Browse files

Use popen instead of g_spawn_command_line_sync()

CCBUG: 318891
parent e0b8883e
......@@ -206,6 +206,22 @@ namespace Oxygen
}
//_________________________________________________________
bool QtSettings::runCommand( const char* cmd, char*& result ) const
{
FILE* fp=popen(cmd,"r");
if(!fp)
return false;
const gulong size=4096;
result=(char*)g_malloc(size);
fgets(result,size,fp);
pclose(fp);
return true;
}
//_________________________________________________________
bool QtSettings::loadKdeGlobals( void )
{
......@@ -266,7 +282,7 @@ namespace Oxygen
// load icon install prefix
gchar* path = 0L;
if( g_spawn_command_line_sync( "kde4-config --path config", &path, 0L, 0L, 0L ) && path )
if( runCommand( "kde4-config --path config", path ) && path )
{
out.split( path );
......@@ -296,7 +312,7 @@ namespace Oxygen
// load icon install prefix
PathList out;
char* path = 0L;
if( g_spawn_command_line_sync( "kde4-config --path icon", &path, 0L, 0L, 0L ) && path )
if( runCommand( "kde4-config --path icon", path ) && path )
{
out.split( path );
g_free( path );
......
......@@ -345,6 +345,9 @@ namespace Oxygen
protected:
//! read output from a command - replacement for not always working g_spawn_command_line_sync()
bool runCommand( const char* cmd, char*& result ) const;
//! kdeglobals settings
/*! returns true if changed */
bool loadKdeGlobals( void );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment