pinokiod 3.19.28 → 3.19.30
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 +13 -12
- package/package.json +1 -1
package/kernel/shell.js
CHANGED
|
@@ -128,7 +128,7 @@ class Shell {
|
|
|
128
128
|
} else if (this.env.PATH) {
|
|
129
129
|
PATH_KEY = "PATH"
|
|
130
130
|
}
|
|
131
|
-
if (this.
|
|
131
|
+
if (this.shell === "cmd.exe") {
|
|
132
132
|
// ignore
|
|
133
133
|
} else {
|
|
134
134
|
this.env[PATH_KEY]= this.kernel.shellpath || [
|
|
@@ -433,7 +433,7 @@ class Shell {
|
|
|
433
433
|
|
|
434
434
|
// Log before resolving
|
|
435
435
|
this._log(buf, cleaned)
|
|
436
|
-
if (this.
|
|
436
|
+
if (this.shell === 'cmd.exe') {
|
|
437
437
|
// For Windows
|
|
438
438
|
this.vt.write('\x1Bc');
|
|
439
439
|
//this.ptyProcess.write('cls\n');
|
|
@@ -461,6 +461,7 @@ class Shell {
|
|
|
461
461
|
this.persistent = params.persistent
|
|
462
462
|
}
|
|
463
463
|
this.prompt_pattern = await this.prompt(params.path)
|
|
464
|
+
console.log("Prompt Pattern", this.prompt_pattern)
|
|
464
465
|
this.cb = cb
|
|
465
466
|
console.log("This.exec")
|
|
466
467
|
let r = await this.exec(params)
|
|
@@ -490,7 +491,7 @@ class Shell {
|
|
|
490
491
|
|
|
491
492
|
//let re = /([\r\n]+[^\r\n]+)(\1)/gs
|
|
492
493
|
let re = /(.+)(\1)/gs
|
|
493
|
-
console.log("Prompt spawn")
|
|
494
|
+
console.log("Prompt spawn", this.shell)
|
|
494
495
|
let term = pty.spawn(this.shell, this.args, config)
|
|
495
496
|
let ready
|
|
496
497
|
let vt = new Terminal({
|
|
@@ -565,7 +566,7 @@ class Shell {
|
|
|
565
566
|
// if params.message is empty, filter out
|
|
566
567
|
//let delimiter = " && "
|
|
567
568
|
let delimiter
|
|
568
|
-
if (this.
|
|
569
|
+
if (this.shell === "cmd.exe") {
|
|
569
570
|
if (params.chain) {
|
|
570
571
|
if (params.chain === "&") {
|
|
571
572
|
delimiter = " && "; // stop if one command in the chain fails
|
|
@@ -692,7 +693,7 @@ class Shell {
|
|
|
692
693
|
// 2. conda_activation
|
|
693
694
|
|
|
694
695
|
let timeout
|
|
695
|
-
if (this.
|
|
696
|
+
if (this.shell === "cmd.exe") {
|
|
696
697
|
timeout = 'C:\\Windows\\System32\\timeout /t 1 > nul'
|
|
697
698
|
} else {
|
|
698
699
|
timeout = 'sleep 1'
|
|
@@ -703,7 +704,7 @@ class Shell {
|
|
|
703
704
|
if (typeof conda_activate === "string") {
|
|
704
705
|
if (conda_activate === "minimal") {
|
|
705
706
|
conda_activation = [
|
|
706
|
-
(this.
|
|
707
|
+
(this.shell === 'cmd.exe' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
707
708
|
'conda activate base',
|
|
708
709
|
]
|
|
709
710
|
}
|
|
@@ -715,7 +716,7 @@ class Shell {
|
|
|
715
716
|
let env_exists = await this.exists(env_path)
|
|
716
717
|
if (env_exists) {
|
|
717
718
|
conda_activation = [
|
|
718
|
-
(this.
|
|
719
|
+
(this.shell === 'cmd.exe' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
719
720
|
`conda deactivate`,
|
|
720
721
|
`conda deactivate`,
|
|
721
722
|
`conda deactivate`,
|
|
@@ -725,7 +726,7 @@ class Shell {
|
|
|
725
726
|
]
|
|
726
727
|
} else {
|
|
727
728
|
conda_activation = [
|
|
728
|
-
(this.
|
|
729
|
+
(this.shell === 'cmd.exe' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
729
730
|
`conda create -y -p ${env_path} ${conda_python} ${conda_args ? conda_args : ''}`,
|
|
730
731
|
`conda deactivate`,
|
|
731
732
|
`conda deactivate`,
|
|
@@ -738,7 +739,7 @@ class Shell {
|
|
|
738
739
|
} else if (conda_name) {
|
|
739
740
|
if (conda_name === "base") {
|
|
740
741
|
conda_activation = [
|
|
741
|
-
(this.
|
|
742
|
+
(this.shell === 'cmd.exe' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
742
743
|
`conda deactivate`,
|
|
743
744
|
`conda deactivate`,
|
|
744
745
|
`conda deactivate`,
|
|
@@ -752,7 +753,7 @@ class Shell {
|
|
|
752
753
|
let env_exists = await this.exists(env_path)
|
|
753
754
|
if (env_exists) {
|
|
754
755
|
conda_activation = [
|
|
755
|
-
(this.
|
|
756
|
+
(this.shell === 'cmd.exe' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
756
757
|
`conda deactivate`,
|
|
757
758
|
`conda deactivate`,
|
|
758
759
|
`conda deactivate`,
|
|
@@ -762,7 +763,7 @@ class Shell {
|
|
|
762
763
|
]
|
|
763
764
|
} else {
|
|
764
765
|
conda_activation = [
|
|
765
|
-
(this.
|
|
766
|
+
(this.shell === 'cmd.exe' ? 'conda_hook' : `eval "$(conda shell.bash hook)"`),
|
|
766
767
|
`conda create -y -n ${conda_name} ${conda_python} ${conda_args ? conda_args : ''}`,
|
|
767
768
|
`conda deactivate`,
|
|
768
769
|
`conda deactivate`,
|
|
@@ -1243,7 +1244,7 @@ ${cleaned}
|
|
|
1243
1244
|
this.params.onready()
|
|
1244
1245
|
}
|
|
1245
1246
|
if (this.ptyProcess) {
|
|
1246
|
-
this.ptyProcess.write(`${this.cmd}${
|
|
1247
|
+
this.ptyProcess.write(`${this.cmd}${this.EOL}`)
|
|
1247
1248
|
// setTimeout(() => {
|
|
1248
1249
|
// this.ptyProcess.write('\x1B[?2004h');
|
|
1249
1250
|
// }, 500)
|