File tree 1 file changed +21
-7
lines changed
1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -106,13 +106,27 @@ def ask_confirmation(prompt: Confirmation) -> str:
106
106
107
107
108
108
def start_shell () -> pexpect .spawn : # type: ignore
109
- SHELL = pexpect .spawn (
110
- "/bin/bash" ,
111
- env = {** os .environ , ** {"PS1" : PROMPT }}, # type: ignore[arg-type]
112
- echo = False ,
113
- encoding = "utf-8" ,
114
- timeout = TIMEOUT ,
115
- )
109
+ try :
110
+ SHELL = pexpect .spawn (
111
+ "/bin/bash" ,
112
+ env = {** os .environ , ** {"PS1" : PROMPT }}, # type: ignore[arg-type]
113
+ echo = False ,
114
+ encoding = "utf-8" ,
115
+ timeout = TIMEOUT ,
116
+ )
117
+ SHELL .sendline (f"export PS1={ PROMPT } " )
118
+ except Exception as e :
119
+ traceback .print_exc ()
120
+ console .log (f"Error starting shell: { e } . Retrying without rc ..." )
121
+
122
+ SHELL = pexpect .spawn (
123
+ "/bin/bash --noprofile --norc" ,
124
+ env = {** os .environ , ** {"PS1" : PROMPT }}, # type: ignore[arg-type]
125
+ echo = False ,
126
+ encoding = "utf-8" ,
127
+ timeout = TIMEOUT ,
128
+ )
129
+
116
130
SHELL .expect (PROMPT , timeout = TIMEOUT )
117
131
SHELL .sendline ("stty -icanon -echo" )
118
132
SHELL .expect (PROMPT , timeout = TIMEOUT )
You can’t perform that action at this time.
0 commit comments