systeminformation 5.17.14 → 5.17.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/usb.js +18 -2
- package/lib/util.js +2 -2
- package/package.json +1 -1
package/lib/usb.js
CHANGED
|
@@ -125,20 +125,36 @@ function parseDarwinUsb(usb, id) {
|
|
|
125
125
|
if (lines[i] !== '{' && lines[i] !== '}' && lines[i + 1] && lines[i + 1].trim() !== '}') {
|
|
126
126
|
lines[i] = lines[i] + ',';
|
|
127
127
|
}
|
|
128
|
+
|
|
129
|
+
lines[i] = lines[i].replace(':Yes,', ':"Yes",');
|
|
128
130
|
lines[i] = lines[i].replace(': Yes,', ': "Yes",');
|
|
131
|
+
lines[i] = lines[i].replace(': Yes', ': "Yes"');
|
|
132
|
+
lines[i] = lines[i].replace(':No,', ':"No",');
|
|
129
133
|
lines[i] = lines[i].replace(': No,', ': "No",');
|
|
134
|
+
lines[i] = lines[i].replace(': No', ': "No"');
|
|
135
|
+
|
|
136
|
+
// In this case (("com.apple.developer.driverkit.transport.usb"))
|
|
137
|
+
lines[i] = lines[i].replace('((', '').replace('))', '');
|
|
138
|
+
|
|
139
|
+
// In case we have <923c11> we need make it "<923c11>" for correct JSON parse
|
|
140
|
+
const match = /<(\w+)>/.exec(lines[i]);
|
|
141
|
+
if (match) {
|
|
142
|
+
const number = match[0];
|
|
143
|
+
lines[i] = lines[i].replace(number, `"${number}"`);
|
|
144
|
+
}
|
|
130
145
|
}
|
|
131
146
|
const usbObj = JSON.parse(lines.join('\n'));
|
|
132
|
-
const removableDrive = usbObj['Built-In'].toLowerCase() !== 'yes' && usbObj['non-removable'].toLowerCase() === 'no';
|
|
147
|
+
const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true);
|
|
133
148
|
|
|
134
149
|
result.bus = null;
|
|
135
150
|
result.deviceId = null;
|
|
136
151
|
result.id = usbObj['USB Address'] || null;
|
|
137
152
|
result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null;
|
|
138
153
|
result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : ''));
|
|
139
|
-
result.removable = usbObj['non-removable'].toLowerCase() === 'no';
|
|
154
|
+
result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true;
|
|
140
155
|
result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
|
|
141
156
|
result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null;
|
|
157
|
+
|
|
142
158
|
result.maxPower = null;
|
|
143
159
|
result.serialNumber = usbObj['kUSBSerialNumberString'] || null;
|
|
144
160
|
|
package/lib/util.js
CHANGED
|
@@ -378,7 +378,7 @@ function powerShellProceedResults(data) {
|
|
|
378
378
|
|
|
379
379
|
function powerShellStart() {
|
|
380
380
|
if (!_psChild) {
|
|
381
|
-
_psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
|
|
381
|
+
_psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
|
|
382
382
|
stdio: 'pipe',
|
|
383
383
|
windowsHide: true,
|
|
384
384
|
maxBuffer: 1024 * 20000,
|
|
@@ -451,7 +451,7 @@ function powerShell(cmd) {
|
|
|
451
451
|
return new Promise((resolve) => {
|
|
452
452
|
process.nextTick(() => {
|
|
453
453
|
try {
|
|
454
|
-
const child = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
|
|
454
|
+
const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
|
|
455
455
|
stdio: 'pipe',
|
|
456
456
|
windowsHide: true,
|
|
457
457
|
maxBuffer: 1024 * 20000,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.17.
|
|
3
|
+
"version": "5.17.16",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|