pinokiod 3.19.71 → 3.19.73
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 +10 -2
- package/package.json +1 -1
package/kernel/index.js
CHANGED
|
@@ -604,15 +604,22 @@ class Kernel {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
which(name, pattern) {
|
|
607
|
+
console.log("Which", { name, pattern })
|
|
607
608
|
if (this.platform === "win32") {
|
|
608
609
|
try {
|
|
609
610
|
const result = execSync(`where ${name}`, { env: this.envs, encoding: "utf-8" })
|
|
610
611
|
const lines = result.trim().split("\r\n")
|
|
612
|
+
console.log({ result, lines })
|
|
611
613
|
if (pattern) {
|
|
612
614
|
let match = null
|
|
613
615
|
for(let line of lines) {
|
|
614
|
-
|
|
615
|
-
if (
|
|
616
|
+
let matches = /^\/(.+)\/([dgimsuy]*)$/gs.exec(pattern)
|
|
617
|
+
if (!/g/.test(matches[2])) {
|
|
618
|
+
matches[2] += "g" // if g option is not included, include it (need it for matchAll)
|
|
619
|
+
}
|
|
620
|
+
let re = new RegExp(matches[1], matches[2])
|
|
621
|
+
console.log("testing", { line, pattern, re })
|
|
622
|
+
if (re.test(line)) {
|
|
616
623
|
match = line
|
|
617
624
|
console.log("matched", { line })
|
|
618
625
|
break
|
|
@@ -627,6 +634,7 @@ class Kernel {
|
|
|
627
634
|
}
|
|
628
635
|
}
|
|
629
636
|
} catch (e) {
|
|
637
|
+
console.log("Error", e)
|
|
630
638
|
return null
|
|
631
639
|
}
|
|
632
640
|
} else {
|