pinokiod 3.19.34 → 3.19.36
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 +18 -16
- package/package.json +1 -1
package/kernel/shell.js
CHANGED
|
@@ -494,7 +494,6 @@ class Shell {
|
|
|
494
494
|
console.log("Prompt spawn", this.shell)
|
|
495
495
|
console.log("Prompt config", config)
|
|
496
496
|
let term = pty.spawn(this.shell, this.args, config)
|
|
497
|
-
let ready
|
|
498
497
|
let vt = new Terminal({
|
|
499
498
|
allowProposedApi: true
|
|
500
499
|
})
|
|
@@ -502,8 +501,8 @@ class Shell {
|
|
|
502
501
|
vt.loadAddon(vts)
|
|
503
502
|
|
|
504
503
|
let queue = fastq((data, cb) => {
|
|
505
|
-
console.log("Vt.write", { data,
|
|
506
|
-
if (
|
|
504
|
+
console.log("Vt.write", { data, prompt_ready: this.prompt_ready, prompt_done: this.prompt_done })
|
|
505
|
+
if (this.prompt_ready) {
|
|
507
506
|
vt.write(data, () => {
|
|
508
507
|
let buf = vts.serialize()
|
|
509
508
|
console.log({ buf })
|
|
@@ -511,9 +510,10 @@ class Shell {
|
|
|
511
510
|
const match = re.exec(buf)
|
|
512
511
|
console.log({ match })
|
|
513
512
|
if (match && match.length > 0) {
|
|
514
|
-
|
|
513
|
+
this.prompt_ready = false
|
|
514
|
+
this.prompt_done = true
|
|
515
515
|
let stripped = this.stripAnsi(match[1])
|
|
516
|
-
console.log({ stripped })
|
|
516
|
+
console.log({ stripped, prompt_ready: this.prompt_ready, prompt_done: this.prompt_done })
|
|
517
517
|
const p = stripped
|
|
518
518
|
.replaceAll(/[\r\n]/g, "")
|
|
519
519
|
.trim()
|
|
@@ -528,17 +528,19 @@ class Shell {
|
|
|
528
528
|
}
|
|
529
529
|
}, 1)
|
|
530
530
|
term.onData((data) => {
|
|
531
|
-
console.log("Prompt onData", { data,
|
|
532
|
-
if (
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
531
|
+
console.log("Prompt onData", { data, prompt_ready: this.prompt_ready, prompt_done: this.prompt_done })
|
|
532
|
+
if (!this.prompt_done) {
|
|
533
|
+
if (this.prompt_ready) {
|
|
534
|
+
queue.push(data)
|
|
535
|
+
} else {
|
|
536
|
+
setTimeout(() => {
|
|
537
|
+
if (!this.prompt_ready) {
|
|
538
|
+
this.prompt_ready = true
|
|
539
|
+
console.log("P", { eol: this.EOL, shell: this.shell, args: this.args, prompt_ready: this.prompt_ready })
|
|
540
|
+
term.write(`echo pinokio${this.EOL}echo pinokio${this.EOL}`)
|
|
541
|
+
}
|
|
542
|
+
}, 500)
|
|
543
|
+
}
|
|
542
544
|
}
|
|
543
545
|
});
|
|
544
546
|
})
|