Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Nov 14, 2024
1 parent eb471db commit 6508954
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion moler/config/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
%% %%% %%% %% %%% %% %%% %%%%%%%%% %%% %%%%%%%
%% %%%%% %% %%% %% %%% %%% %%% %%%
%% %%% %% %%%%%%%%%%% %%%%%%%%% %%%%%%%%%% %%% %%%
Prompt detecting v3.
Prompt detecting v4.
"""


Expand Down
8 changes: 5 additions & 3 deletions moler/device/proxy_pc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

from moler.events.shared.wait4 import Wait4
import inspect
import threading

# helper variables to improve readability of state machines
# f.ex. moler.device.textualdevice introduces state TextualDevice.not_connected = "NOT_CONNECTED"
Expand Down Expand Up @@ -273,8 +274,6 @@ def on_connection_made(self, connection):
self._prompt_detected = False # prompt not defined in SM
self._set_state(PROXY_PC)
self._detect_after_open_prompt(self._set_after_open_prompt)
if self._sleep_after_state_change is not None and self._sleep_after_state_change > 0:
time.sleep(self._sleep_after_state_change)

def on_connection_lost(self, connection):
"""
Expand All @@ -286,7 +285,8 @@ def on_connection_lost(self, connection):
self._set_state(NOT_CONNECTED)

def _detect_after_open_prompt(self, set_callback):
self.logger.info(f"Command to detect prompt will be sent. Callback: {set_callback}")
current_thread = threading.current_thread()
self.logger.info(f"Command to detect prompt will be sent. Callback: {set_callback} Current thread: {current_thread.name}, ID: {current_thread.ident}")
self._prompt_detected = False
self._after_open_prompt_detector = Wait4(
detect_patterns=[rf'^(.+){self._detecting_prompt_cmd}'],
Expand Down Expand Up @@ -491,3 +491,5 @@ def _detect_prompt_get_cmd(self):
self._after_open_prompt_detector = None
if not self._prompt_detected:
raise MolerException(f"Device {self.public_name} cannot detect prompt!")
self.io_connection.moler_connection.sendline("")
time.sleep(self._prompt_detector_timeout)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

setup(
name='moler',
version='3.12.153',
version='3.12.154',
description='Moler is a library for working with terminals, mainly for automated tests', # Required
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 6508954

Please sign in to comment.