[gnome-shell] hwtest.js: Don't parse JSON with regexps
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] hwtest.js: Don't parse JSON with regexps
- Date: Wed, 16 Jul 2014 18:29:29 +0000 (UTC)
commit 46c86e093c35ed2c8d2ad4e93ddc0cbe5d55f76d
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Wed Jul 16 13:20:15 2014 -0400
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
js/perf/hwtest.js | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/js/perf/hwtest.js b/js/perf/hwtest.js
index 1f0b181..8ef6102 100644
--- a/js/perf/hwtest.js
+++ b/js/perf/hwtest.js
@@ -78,7 +78,7 @@ function extractBootTimestamp() {
'MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5',
'UNIT=graphical.target',
'-o',
- 'json-pretty'],
+ 'json'],
Gio.SubprocessFlags.STDOUT_PIPE);
let result = null;
@@ -88,10 +88,8 @@ function extractBootTimestamp() {
if (line === null)
break;
- let m = /.*"__MONOTONIC_TIMESTAMP".*"([0-9]+)"/.exec(line);
- if (m) {
- result = Number(m[1]);
- }
+ let fields = JSON.parse(line);
+ result = Number(fields['__MONOTONIC_TIMESTAMP']);
}
datastream.close(null);
return result;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]