mirror of
https://github.com/morgan9e/gnome-shell-extension-freon
synced 2026-04-14 00:14:14 +09:00
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:
11
extension.js
11
extension.js
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user