hwtest.js: Don't parse JSON with regexps
Use JSON.parse() to parse systemd log records, rather than using regexps. https://bugzilla.gnome.org/show_bug.cgi?id=732350
This commit is contained in:
parent
c6350aa557
commit
46c86e093c
@ -78,7 +78,7 @@ function extractBootTimestamp() {
|
|||||||
'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
|
'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
|
||||||
'UNIT=graphical.target',
|
'UNIT=graphical.target',
|
||||||
'-o',
|
'-o',
|
||||||
'json-pretty'],
|
'json'],
|
||||||
Gio.SubprocessFlags.STDOUT_PIPE);
|
Gio.SubprocessFlags.STDOUT_PIPE);
|
||||||
let result = null;
|
let result = null;
|
||||||
|
|
||||||
@ -88,10 +88,8 @@ function extractBootTimestamp() {
|
|||||||
if (line === null)
|
if (line === null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
let m = /.*"__MONOTONIC_TIMESTAMP".*"([0-9]+)"/.exec(line);
|
let fields = JSON.parse(line);
|
||||||
if (m) {
|
result = Number(fields['__MONOTONIC_TIMESTAMP']);
|
||||||
result = Number(m[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
datastream.close(null);
|
datastream.close(null);
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user