@@ -3197,7 +3197,8 @@ def async_alert(self, alert_msg: str, new_prompt: Optional[str] = None) -> None:
31973197
31983198 # Generate a string to clear the prompt and input lines and replace with the alert
31993199 terminal_str = self ._clear_input_lines_str ()
3200- terminal_str += alert_msg + '\n '
3200+ if alert_msg :
3201+ terminal_str += alert_msg + '\n '
32013202
32023203 # Set the new prompt now that _clear_input_lines_str is done using the old prompt
32033204 if new_prompt is not None :
@@ -3230,34 +3231,8 @@ def async_update_prompt(self, new_prompt: str) -> None: # pragma: no cover
32303231 first, which ensures a prompt is onscreen
32313232
32323233 :param new_prompt: what to change the prompt to
3233- :raises RuntimeError if called while another thread holds terminal_lock
32343234 """
3235- if not (vt100_support and self .use_rawinput ):
3236- return
3237-
3238- # Sanity check that can't fail if self.terminal_lock was acquired before calling this function
3239- if self .terminal_lock .acquire (blocking = False ):
3240-
3241- # Generate a string to clear the prompt and input lines
3242- terminal_str = self ._clear_input_lines_str ()
3243-
3244- # Set the new prompt now that _clear_input_lines_str is done using the old prompt
3245- self .prompt = new_prompt
3246- rl_set_prompt (self .prompt )
3247-
3248- # Print terminal_str to erase the lines
3249- if rl_type == RlType .GNU :
3250- sys .stderr .write (terminal_str )
3251- elif rl_type == RlType .PYREADLINE :
3252- readline .rl .mode .console .write (terminal_str )
3253-
3254- # Redraw the prompt and input lines
3255- rl_force_redisplay ()
3256-
3257- self .terminal_lock .release ()
3258-
3259- else :
3260- raise RuntimeError ("another thread holds terminal_lock" )
3235+ self .async_alert ('' , new_prompt )
32613236
32623237 @staticmethod
32633238 def set_window_title (title : str ) -> None : # pragma: no cover
0 commit comments