pinokiod 3.19.68 → 3.19.71
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 -4
- package/kernel/shell.js +17 -1
- package/package.json +1 -1
package/kernel/index.js
CHANGED
|
@@ -603,15 +603,28 @@ class Kernel {
|
|
|
603
603
|
})
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
which(name) {
|
|
606
|
+
which(name, pattern) {
|
|
607
607
|
if (this.platform === "win32") {
|
|
608
608
|
try {
|
|
609
609
|
const result = execSync(`where ${name}`, { env: this.envs, encoding: "utf-8" })
|
|
610
610
|
const lines = result.trim().split("\r\n")
|
|
611
|
-
if (
|
|
612
|
-
|
|
611
|
+
if (pattern) {
|
|
612
|
+
let match = null
|
|
613
|
+
for(let line of lines) {
|
|
614
|
+
console.log("testing", { line, pattern })
|
|
615
|
+
if (pattern.test(line)) {
|
|
616
|
+
match = line
|
|
617
|
+
console.log("matched", { line })
|
|
618
|
+
break
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return match
|
|
613
622
|
} else {
|
|
614
|
-
|
|
623
|
+
if (lines.length > 0) {
|
|
624
|
+
return lines[0]
|
|
625
|
+
} else {
|
|
626
|
+
return null
|
|
627
|
+
}
|
|
615
628
|
}
|
|
616
629
|
} catch (e) {
|
|
617
630
|
return null
|
package/kernel/shell.js
CHANGED
|
@@ -991,7 +991,20 @@ class Shell {
|
|
|
991
991
|
}
|
|
992
992
|
|
|
993
993
|
// 3. construct params.message
|
|
994
|
-
|
|
994
|
+
let activation = conda_activation.concat(venv_activation)
|
|
995
|
+
if (activation.length > 0) {
|
|
996
|
+
let activation_str = this.build({
|
|
997
|
+
chain: "*",
|
|
998
|
+
message: activation
|
|
999
|
+
})
|
|
1000
|
+
params.message = [activation_str].concat(params.message)
|
|
1001
|
+
} else {
|
|
1002
|
+
params.message = params.message
|
|
1003
|
+
}
|
|
1004
|
+
// params.message = conda_activation.concat(venv_activation).concat(params.message)
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
995
1008
|
// params.message = conda_activation.concat(venv_activation).concat(params.message).map((cmd) => {
|
|
996
1009
|
// if (this.platform === 'win32') {
|
|
997
1010
|
// return `call ${cmd}`
|
|
@@ -1002,8 +1015,11 @@ class Shell {
|
|
|
1002
1015
|
return params
|
|
1003
1016
|
}
|
|
1004
1017
|
async exec(params) {
|
|
1018
|
+
console.log("before activate", params.message)
|
|
1005
1019
|
params = await this.activate(params)
|
|
1020
|
+
console.log("after activate", params.message)
|
|
1006
1021
|
this.cmd = this.build(params)
|
|
1022
|
+
console.log("build", this.cmd)
|
|
1007
1023
|
let res = await new Promise((resolve, reject) => {
|
|
1008
1024
|
this.resolve = resolve
|
|
1009
1025
|
this.reject = reject
|