Merge pull request #51 from adrianbroher/glib-path

GLib.find_program_in_path() is used instead of spawning which for hddtemp
This commit is contained in:
Dipesh Acharya
2013-03-07 07:27:27 -08:00

View File

@@ -63,14 +63,11 @@ CpuTemperature.prototype = {
},
_detectHDDTemp: function(){
//detect if hddtemp is installed
let hddtempPath = null;
let ret = GLib.spawn_command_line_sync("which hddtemp");
if ( (ret[0]) && (ret[3] == 0) ) {//if yes
hddtempPath =ret[1].toString().split("\n", 1)[0];
// for any reason it is not possible to run hddtemp directly.
let hddtempPath = GLib.find_program_in_path('hddtemp');
if(hddtempPath) {
// check if this user can run hddtemp directly.
if(GLib.spawn_command_line_sync(hddtempPath)[3])
hddtempPath = null;
hddtempPath = '';
}
return hddtempPath;
},