pinokiod 3.19.56 → 3.19.58

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.
Files changed (2) hide show
  1. package/kernel/shell.js +22 -50
  2. package/package.json +1 -1
package/kernel/shell.js CHANGED
@@ -265,28 +265,28 @@ class Shell {
265
265
  this.args = ["--noprofile", "--norc"]
266
266
  //this.args = [ "--login", "-i"]
267
267
  this.EOL = "\n"
268
- if (this.platform === "win32") {
269
- console.log("before transform this.env", this.env)
270
- for(let key in this.env) {
271
- let val = this.env[key]
272
- if (val && typeof val === "string") {
273
- // split with ;
274
- let chunks = val.split(";")
275
- let transformed_chunks = []
276
- for(let chunk of chunks) {
277
- if (path.isAbsolute(chunk)) {
278
- let transformed = normalize(chunk)
279
- transformed = "/" + transformed.replace(":", "")
280
- transformed_chunks.push(transformed)
281
- } else {
282
- transformed_chunks.push(chunk)
283
- }
284
- }
285
- this.env[key] = transformed_chunks.join(";")
286
- }
287
- }
288
- console.log("after transform this.env", this.env)
289
- }
268
+ //if (this.platform === "win32") {
269
+ // console.log("before transform this.env", this.env)
270
+ // for(let key in this.env) {
271
+ // let val = this.env[key]
272
+ // if (val && typeof val === "string") {
273
+ // // split with ;
274
+ // let chunks = val.split(";")
275
+ // let transformed_chunks = []
276
+ // for(let chunk of chunks) {
277
+ // if (path.isAbsolute(chunk)) {
278
+ // let transformed = :normalize(chunk)
279
+ // transformed = "/" + transformed.replace(":", "")
280
+ // transformed_chunks.push(transformed)
281
+ // } else {
282
+ // transformed_chunks.push(chunk)
283
+ // }
284
+ // }
285
+ // this.env[key] = transformed_chunks.join(";")
286
+ // }
287
+ // }
288
+ // console.log("after transform this.env", this.env)
289
+ //}
290
290
  }
291
291
  }
292
292
  console.log({ shell: this.shell, args: this.args, eol: this.EOL })
@@ -485,9 +485,7 @@ class Shell {
485
485
  this.persistent = params.persistent
486
486
  }
487
487
  this.prompt_pattern = await this.prompt(params.path)
488
- console.log("Prompt Pattern", this.prompt_pattern)
489
488
  this.cb = cb
490
- console.log("This.exec")
491
489
  let r = await this.exec(params)
492
490
  return r
493
491
  }
@@ -515,8 +513,6 @@ class Shell {
515
513
 
516
514
  //let re = /([\r\n]+[^\r\n]+)(\1)/gs
517
515
  let re = /(.+)(\1)/gs
518
- console.log("Prompt spawn", this.shell)
519
- console.log("Prompt config", config)
520
516
  let term = pty.spawn(this.shell, this.args, config)
521
517
  let vt = new Terminal({
522
518
  allowProposedApi: true
@@ -525,19 +521,15 @@ class Shell {
525
521
  vt.loadAddon(vts)
526
522
 
527
523
  let queue = fastq((data, cb) => {
528
- console.log("Vt.write", { data, prompt_ready: this.prompt_ready, prompt_done: this.prompt_done })
529
524
  if (this.prompt_ready) {
530
525
  vt.write(data, () => {
531
526
  let buf = vts.serialize()
532
- console.log({ buf })
533
527
  let re = /(.+)echo pinokio[\r\n]+pinokio[\r\n]+(\1)/gs
534
528
  const match = re.exec(buf)
535
- console.log({ match })
536
529
  if (match && match.length > 0) {
537
530
  this.prompt_ready = false
538
531
  this.prompt_done = true
539
532
  let stripped = this.stripAnsi(match[1])
540
- console.log({ stripped, prompt_ready: this.prompt_ready, prompt_done: this.prompt_done })
541
533
  const p = stripped
542
534
  .replaceAll(/[\r\n]/g, "")
543
535
  .trim()
@@ -552,7 +544,6 @@ class Shell {
552
544
  }
553
545
  }, 1)
554
546
  term.onData((data) => {
555
- console.log("Prompt onData", { data, prompt_ready: this.prompt_ready, prompt_done: this.prompt_done })
556
547
  if (!this.prompt_done) {
557
548
  if (this.prompt_ready) {
558
549
  queue.push(data)
@@ -560,7 +551,6 @@ class Shell {
560
551
  setTimeout(() => {
561
552
  if (!this.prompt_ready) {
562
553
  this.prompt_ready = true
563
- console.log("P", { eol: this.EOL, shell: this.shell, args: this.args, prompt_ready: this.prompt_ready })
564
554
  term.write(`echo pinokio${this.EOL}echo pinokio${this.EOL}`)
565
555
  }
566
556
  }, 500)
@@ -593,18 +583,6 @@ class Shell {
593
583
  // let m = params.message + delimiter + `echo "FINISHED: ${params.message}"\r\n`
594
584
  // return m
595
585
  } else if (Array.isArray(params.message)) {
596
-
597
- let message = []
598
- if (/bash/i.test(this.shell)) {
599
- message = ["set -x"]
600
- }
601
- for(let i=0; i<params.message.length; i++) {
602
- message.push(params.message[i])
603
- message.push(`echo ${i}`)
604
- }
605
- params.message = message
606
-
607
-
608
586
  // params.message.push(`echo "SHELL FINISHED RUNNING"\r\n`)
609
587
  // if params.message is empty, filter out
610
588
  //let delimiter = " && "
@@ -1029,9 +1007,7 @@ class Shell {
1029
1007
  }
1030
1008
  async exec(params) {
1031
1009
  params = await this.activate(params)
1032
- console.log("#Exec 1", { params })
1033
1010
  this.cmd = this.build(params)
1034
- console.log("#Exec 2", { cmd: this.cmd })
1035
1011
  let res = await new Promise((resolve, reject) => {
1036
1012
  this.resolve = resolve
1037
1013
  this.reject = reject
@@ -1051,11 +1027,8 @@ class Shell {
1051
1027
  if (!this.ptyProcess) {
1052
1028
  // ptyProcess doesn't exist => create
1053
1029
  this.done = false
1054
- console.log("EXEC SPAWN")
1055
- console.log("EXEC config", config)
1056
1030
  this.ptyProcess = pty.spawn(this.shell, this.args, config)
1057
1031
  this.ptyProcess.onData((data) => {
1058
- console.log("EXEC ONDATA", data)
1059
1032
  if (!this.monitor) {
1060
1033
  this.monitor = ""
1061
1034
  }
@@ -1308,7 +1281,6 @@ ${cleaned}
1308
1281
  this.params.onready()
1309
1282
  }
1310
1283
  if (this.ptyProcess) {
1311
- console.log("ptyProcess.write", { cmd: this.cmd, eol: this.EOL })
1312
1284
  this.ptyProcess.write(`${this.cmd}${this.EOL}`)
1313
1285
  // setTimeout(() => {
1314
1286
  // this.ptyProcess.write('\x1B[?2004h');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.19.56",
3
+ "version": "3.19.58",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {