remove error from command output #114

This commit is contained in:
UshakovVasilii
2019-05-12 18:53:28 +03:00
parent d5b37692d9
commit 888ce3643e
2 changed files with 11 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ var CommandLineUtil = class {
let childWatch = GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, (pid, status, requestObj) => {
let output = [];
let error_output = [];
let [line, size] = [null, 0];
while (([line, size] = outReader.read_line(null)) != null && line != null) {
@@ -38,12 +39,13 @@ var CommandLineUtil = class {
while (([line, size] = errReader.read_line(null)) != null && line != null) {
if(line)
output.push(ByteArray.toString(line));
error_output.push(ByteArray.toString(line));
}
stderr.close(null);
GLib.source_remove(childWatch);
this._output = output;
this._error_output = error_output;
this._updated = true;
callback();
});
@@ -59,7 +61,7 @@ var CommandLineUtil = class {
get updated (){
return this._updated;
}
set updated (updated){
this._updated = updated;
}

View File

@@ -44,7 +44,13 @@ var NvidiaUtil = class extends CommandLineUtil.CommandLineUtil {
}
get temp() {
if(!this._output)
let output = [];
if(this._output)
output.push(...this._output)
if(this._error_output)
output.push(...this._error_output)
if(output.length === 0)
return [];
let temps = [];
for (let line of this._output) {