pinokiod 3.2.218 → 3.2.219
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 +17 -1
- package/kernel/shell.js +7 -2
- package/package.json +1 -1
package/kernel/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const waitOn = require('wait-on');
|
|
|
8
8
|
const system = require('systeminformation');
|
|
9
9
|
const Sysinfo = require('./sysinfo')
|
|
10
10
|
const portfinder = require('portfinder-cp');
|
|
11
|
+
const { execSync } = require('child_process')
|
|
11
12
|
const Loader = require("./loader")
|
|
12
13
|
const Bin = require('./bin')
|
|
13
14
|
const Api = require("./api")
|
|
@@ -459,7 +460,22 @@ class Kernel {
|
|
|
459
460
|
env: this.envs,
|
|
460
461
|
envs: this.envs,
|
|
461
462
|
which: (name) => {
|
|
462
|
-
|
|
463
|
+
if (this.platform === "win32") {
|
|
464
|
+
try {
|
|
465
|
+
const result = execSync(`where ${name}`, { encoding: "utf-8" })
|
|
466
|
+
const lines = result.trim().split("\r\n")
|
|
467
|
+
if (lines.length > 0) {
|
|
468
|
+
return lines[0]
|
|
469
|
+
} else {
|
|
470
|
+
return null
|
|
471
|
+
}
|
|
472
|
+
} catch (e) {
|
|
473
|
+
console.log(`>> which ${name}`, e)
|
|
474
|
+
return null
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
return which.sync(name, { nothrow: true, path: this.envs.PATH })
|
|
478
|
+
}
|
|
463
479
|
}
|
|
464
480
|
})
|
|
465
481
|
}
|
package/kernel/shell.js
CHANGED
|
@@ -236,9 +236,14 @@ class Shell {
|
|
|
236
236
|
process.env = this.env
|
|
237
237
|
sudo.exec(params.message, options, (err, stdout, stderr) => {
|
|
238
238
|
if (err) {
|
|
239
|
-
|
|
239
|
+
console.log("SUDOPROMPT ERR", err)
|
|
240
|
+
// even when there's an error, just log the error, and don't throw the error. Instead, print the stdout so it displays what happened
|
|
241
|
+
resolve(stdout)
|
|
242
|
+
// reject(err)
|
|
240
243
|
} else if (stderr) {
|
|
241
|
-
|
|
244
|
+
console.log("SUDOPROMPT STDERR", stderr)
|
|
245
|
+
resolve(stdout)
|
|
246
|
+
// reject(stderr)
|
|
242
247
|
} else {
|
|
243
248
|
resolve(stdout)
|
|
244
249
|
}
|