try lscpu if blank cpu_name
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Jan 25, 2024 at 17:21 UTC
03cab630c760f367394030e0a8a13ed321db7ed1
1 file changed
+8
-1
agents/modules_meshcore/computer-identifiers.js
+8
-1
@@ -117,9 +117,16 @@ function linux_identifiers()
117
118
var child = require('child_process').execFile('/bin/sh', ['sh']);
119
child.stdout.str = ''; child.stdout.on('data', dataHandler);
120
- child.stdin.write('cat /proc/cpuinfo | grep "model name" | ' + "tr '\\n' ':' | awk -F: '{ print $2 }'\nexit\n");
120
+ child.stdin.write('cat /proc/cpuinfo | grep -i "model name" | ' + "tr '\\n' ':' | awk -F: '{ print $2 }'\nexit\n");
121
child.waitExit();
122
identifiers['cpu_name'] = child.stdout.str.trim();
123
+ if (identifiers['cpu_name'] == "") { // CPU BLANK, check lscpu instead
124
+ child = require('child_process').execFile('/bin/sh', ['sh']);
125
+ child.stdout.str = ''; child.stdout.on('data', dataHandler);
126
+ child.stdin.write('lscpu | grep -i "model name" | ' + "tr '\\n' ':' | awk -F: '{ print $2 }'\nexit\n");
127
+ child.waitExit();
128
+ identifiers['cpu_name'] = child.stdout.str.trim();
129
+ }
130
child = null;
131
132