pinokiod 3.2.15 → 3.2.17
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/shell.js +6 -0
- package/package.json +1 -1
package/kernel/shell.js
CHANGED
|
@@ -691,6 +691,7 @@ class Shell {
|
|
|
691
691
|
return res
|
|
692
692
|
}
|
|
693
693
|
stop(message) {
|
|
694
|
+
console.log("STOP", { message })
|
|
694
695
|
return this.kill(message)
|
|
695
696
|
}
|
|
696
697
|
continue(message) {
|
|
@@ -705,6 +706,7 @@ class Shell {
|
|
|
705
706
|
}
|
|
706
707
|
}
|
|
707
708
|
kill(message, force) {
|
|
709
|
+
console.log("KILL", { message, force })
|
|
708
710
|
|
|
709
711
|
this.done = true
|
|
710
712
|
this.ready = false
|
|
@@ -815,6 +817,7 @@ ${cleaned}
|
|
|
815
817
|
this.vt.write(msg, () => {
|
|
816
818
|
let buf = this.vts.serialize()
|
|
817
819
|
let cleaned = this.stripAnsi(buf)
|
|
820
|
+
console.log({ buf, cleaned })
|
|
818
821
|
let response = {
|
|
819
822
|
id: this.id,
|
|
820
823
|
raw: msg,
|
|
@@ -824,6 +827,7 @@ ${cleaned}
|
|
|
824
827
|
if (this.cb) this.cb(response)
|
|
825
828
|
|
|
826
829
|
// Decide whether to kill or continue
|
|
830
|
+
console.log("this.ready", this.ready)
|
|
827
831
|
if (this.ready) {
|
|
828
832
|
// when ready, watch out for the prompt pattern that terminates with [\r\n ]
|
|
829
833
|
let termination_prompt_re = new RegExp(this.prompt_pattern + "[ \r\n]*$", "g")
|
|
@@ -835,6 +839,7 @@ ${cleaned}
|
|
|
835
839
|
let cached_msg = msg
|
|
836
840
|
// todo: may need to handle cases when the command returns immediately with no output (example: 'which brew' returns immediately with no text if brew doesn't exist)
|
|
837
841
|
setTimeout(() => {
|
|
842
|
+
console.log({ cache, cleaned })
|
|
838
843
|
if (cache === cleaned) {
|
|
839
844
|
if (this.persistent) {
|
|
840
845
|
if (this.cb) this.cb({
|
|
@@ -862,6 +867,7 @@ ${cleaned}
|
|
|
862
867
|
// when not ready, wait for the first occurence of the prompt pattern.
|
|
863
868
|
let prompt_re = new RegExp(this.prompt_pattern, "g")
|
|
864
869
|
let test = cleaned.replaceAll(/[\r\n]/g, "").match(prompt_re)
|
|
870
|
+
console.log(">>>>>>>>", { cleaned, test, prompt_re })
|
|
865
871
|
if (test) {
|
|
866
872
|
if (test.length > 0) {
|
|
867
873
|
this.ready = true
|