pinokiod 3.0.20 → 3.0.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/sysinfo.js +18 -2
- package/package.json +1 -1
package/kernel/sysinfo.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const system = require('systeminformation')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const path = require('path')
|
|
2
4
|
class Sysinfo {
|
|
3
5
|
async init(kernel) {
|
|
4
6
|
this.kernel = kernel
|
|
@@ -93,6 +95,9 @@ class Sysinfo {
|
|
|
93
95
|
async bluetooth() {
|
|
94
96
|
this.info.bluetooth = await system.bluetoothDevices()
|
|
95
97
|
}
|
|
98
|
+
exists(_path) {
|
|
99
|
+
return new Promise(r=>fs.access(_path, fs.constants.F_OK, e => r(!e)))
|
|
100
|
+
}
|
|
96
101
|
async env () {
|
|
97
102
|
let cmd
|
|
98
103
|
if (this.kernel.platform === "win32") {
|
|
@@ -107,8 +112,19 @@ class Sysinfo {
|
|
|
107
112
|
// console.log(_res)
|
|
108
113
|
// console.log("############### DEBUGGING ENV FINISH")
|
|
109
114
|
|
|
110
|
-
let
|
|
111
|
-
|
|
115
|
+
let conda_path = path.resolve(this.kernel.homedir, "bin", "miniconda")
|
|
116
|
+
let conda_exists = await this.exists(conda_path)
|
|
117
|
+
|
|
118
|
+
let res
|
|
119
|
+
if (conda_exists) {
|
|
120
|
+
res = await this.kernel.bin.exec({ message: cmd }, (stream) => {
|
|
121
|
+
})
|
|
122
|
+
} else {
|
|
123
|
+
console.log("skip conda")
|
|
124
|
+
res = await this.kernel.bin.exec({ message: cmd, conda: { skip: true } }, (stream) => {
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
|
|
112
128
|
let lines = res.response.split(/[\r\n]+/)
|
|
113
129
|
let vars = []
|
|
114
130
|
let started
|