pinokiod 1.1.19 → 1.1.21
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/kernel/index.js +2 -30
- package/kernel/sysinfo.js +15 -1
- package/package.json +1 -1
package/kernel/index.js
CHANGED
|
@@ -230,8 +230,9 @@ class Kernel {
|
|
|
230
230
|
|
|
231
231
|
|
|
232
232
|
let sysinfo = new Sysinfo()
|
|
233
|
-
await sysinfo.init()
|
|
233
|
+
await sysinfo.init(this)
|
|
234
234
|
let info = sysinfo.info
|
|
235
|
+
await fs.promises.mkdir(this.path("logs"), { recursive: true }).catch((e) => { })
|
|
235
236
|
await fs.promises.writeFile(this.path("logs/system.json"), JSON.stringify({
|
|
236
237
|
platform: this.platform,
|
|
237
238
|
arch: this.arch,
|
|
@@ -272,35 +273,6 @@ class Kernel {
|
|
|
272
273
|
console.log("### ERROR", e)
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
|
-
async sysinfo() {
|
|
276
|
-
let g = await system.graphics()
|
|
277
|
-
let gpus
|
|
278
|
-
if (g && g.controllers && g.controllers.length > 0) {
|
|
279
|
-
gpus = g.controllers.map((x) => { return x.vendor.toLowerCase() })
|
|
280
|
-
} else {
|
|
281
|
-
gpus = []
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
let is_nvidia = gpus.find(gpu => /nvidia/i.test(gpu))
|
|
285
|
-
let is_amd = gpus.find(gpu => /(amd|advanced micro devices)/i.test(gpu))
|
|
286
|
-
let is_apple = gpus.find(gpu => /apple/i.test(gpu))
|
|
287
|
-
|
|
288
|
-
let gpu
|
|
289
|
-
if (is_nvidia) {
|
|
290
|
-
gpu = "nvidia"
|
|
291
|
-
} else if (is_amd) {
|
|
292
|
-
gpu = "amd"
|
|
293
|
-
} else if (is_apple) {
|
|
294
|
-
gpu = "apple"
|
|
295
|
-
} else if (gpus.length > 0) {
|
|
296
|
-
gpu = gpus[0]
|
|
297
|
-
} else {
|
|
298
|
-
gpu = "none"
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return { gpus, gpu }
|
|
302
|
-
|
|
303
|
-
}
|
|
304
276
|
async exec(params, ondata) {
|
|
305
277
|
// params.path = this.path()
|
|
306
278
|
// if (this.client) {
|
package/kernel/sysinfo.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const system = require('systeminformation')
|
|
2
2
|
class Sysinfo {
|
|
3
|
-
async init() {
|
|
3
|
+
async init(kernel) {
|
|
4
|
+
this.kernel = kernel
|
|
4
5
|
this.info = {}
|
|
5
6
|
await this.static()
|
|
6
7
|
await this.refresh()
|
|
@@ -11,6 +12,7 @@ class Sysinfo {
|
|
|
11
12
|
await this.cpu()
|
|
12
13
|
await this.os()
|
|
13
14
|
await this.audio()
|
|
15
|
+
await this.env()
|
|
14
16
|
// await this.disk()
|
|
15
17
|
}
|
|
16
18
|
async refresh() {
|
|
@@ -91,5 +93,17 @@ class Sysinfo {
|
|
|
91
93
|
async bluetooth() {
|
|
92
94
|
this.info.bluetooth = await system.bluetoothDevices()
|
|
93
95
|
}
|
|
96
|
+
async env () {
|
|
97
|
+
let cmd
|
|
98
|
+
if (this.kernel.platform === "win32") {
|
|
99
|
+
cmd = "set"
|
|
100
|
+
} else {
|
|
101
|
+
cmd = "env"
|
|
102
|
+
}
|
|
103
|
+
let res = await this.kernel.bin.exec({ message: cmd, conda: "base" }, (stream) => {
|
|
104
|
+
})
|
|
105
|
+
this.info.env = process.env
|
|
106
|
+
this.info.shell_env = res.response
|
|
107
|
+
}
|
|
94
108
|
}
|
|
95
109
|
module.exports = Sysinfo
|