Skip to content

Commit

Permalink
proxy_pc2
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Nov 19, 2024
1 parent 11de6a6 commit 82e0ff8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions moler/device/proxy_pc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,6 @@ def _detect_prompt_get_cmd(self):
self.logger.warning(msg)
raise MolerException(msg)
self.io_connection.moler_connection.sendline("")
sleep = 0.6
self.logger.info(f"Sleep after prompt detection for {sleep} seconds.")
time.sleep(sleep)
if self._sleep_after_state_change is not None and self._sleep_after_state_change > 0:
self.logger.info(f"Sleep after prompt detection for {self._sleep_after_state_change:.2f} seconds.")
time.sleep(self._sleep_after_state_change)
13 changes: 6 additions & 7 deletions moler/device/unixremote2.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,28 +393,27 @@ def _set_after_open_prompt(self, event):
occurrence = event.get_last_occurrence()
prompt = occurrence['groups'][0].rstrip()
state = self._get_current_state()
self.logger.info(f"UnixRemote2 for state '{state}' new prompt '{prompt}' reverse_state_prompts_dict: '{self._reverse_state_prompts_dict}' Current thread: {current_thread.name}, ID: {current_thread.ident}.")
self.logger.debug(f"UnixRemote2 for state '{state}' new prompt '{prompt}' reverse_state_prompts_dict: '{self._reverse_state_prompts_dict}' Current thread: {current_thread.name}, ID: {current_thread.ident}.")
with self._state_prompts_lock:
old_prompt = self._state_prompts.get(state, None)
prompt = re.escape(prompt)
self._state_prompts[state] = prompt
self.logger.info(f"state_prompts after change: {self._state_prompts}")
self.logger.debug(f"state_prompts after change: {self._state_prompts}")
self._prepare_reverse_state_prompts_dict()
if old_prompt is not None and prompt != old_prompt:
self.logger.info(f"Different prompt candidates: '{old_prompt}' -> '{prompt}' for state {state}.")
if state == UNIX_REMOTE:
self._update_depending_on_ux_prompt()
elif state == PROXY_PC:
self._update_depending_on_proxy_prompt()
self.logger.info(f"UnixRemote2. updated _reverse_state_prompts_dict: {self._reverse_state_prompts_dict}")
self.logger.debug(f"UnixRemote2. updated _reverse_state_prompts_dict: {self._reverse_state_prompts_dict}")
if self._prompts_event is not None:
self.logger.info("prompts event is not none")
self.logger.debug("prompts event is not none")
self._prompts_event.change_prompts(
prompts=self._reverse_state_prompts_dict)
self.logger.info(f"New prompts: {self._state_prompts}")
self.logger.info(f"After prepare_reverse_state_prompts_dict: {self._reverse_state_prompts_dict}")
self.logger.debug(f"New prompts: {self._state_prompts}")
self.logger.debug(f"After prepare_reverse_state_prompts_dict: {self._reverse_state_prompts_dict}")
self._prompt_detected = True
self.logger.info("Prompt detected")

@mark_to_call_base_class_method_with_same_name
def _prepare_state_prompts_with_proxy_pc(self):
Expand Down

0 comments on commit 82e0ff8

Please sign in to comment.