pinokiod 3.19.34 → 3.19.35
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 +9 -10
- 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 })
|
|
505
|
+
if (this.prompt_ready) {
|
|
507
506
|
vt.write(data, () => {
|
|
508
507
|
let buf = vts.serialize()
|
|
509
508
|
console.log({ buf })
|
|
@@ -511,9 +510,9 @@ 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
|
|
515
514
|
let stripped = this.stripAnsi(match[1])
|
|
516
|
-
console.log({ stripped })
|
|
515
|
+
console.log({ stripped, prompt_ready: this.prompt_ready })
|
|
517
516
|
const p = stripped
|
|
518
517
|
.replaceAll(/[\r\n]/g, "")
|
|
519
518
|
.trim()
|
|
@@ -528,14 +527,14 @@ class Shell {
|
|
|
528
527
|
}
|
|
529
528
|
}, 1)
|
|
530
529
|
term.onData((data) => {
|
|
531
|
-
console.log("Prompt onData", { data,
|
|
532
|
-
if (
|
|
530
|
+
console.log("Prompt onData", { data, prompt_ready: this.prompt_ready })
|
|
531
|
+
if (this.prompt_ready) {
|
|
533
532
|
queue.push(data)
|
|
534
533
|
} else {
|
|
535
534
|
setTimeout(() => {
|
|
536
|
-
if (!
|
|
537
|
-
|
|
538
|
-
console.log("P", { eol: this.EOL, shell: this.shell, args: this.args,
|
|
535
|
+
if (!this.prompt_ready) {
|
|
536
|
+
this.prompt_ready = true
|
|
537
|
+
console.log("P", { eol: this.EOL, shell: this.shell, args: this.args, prompt_ready: this.prompt_ready })
|
|
539
538
|
term.write(`echo pinokio${this.EOL}echo pinokio${this.EOL}`)
|
|
540
539
|
}
|
|
541
540
|
}, 500)
|