diff --git a/aexpect/client.py b/aexpect/client.py index 967310f..8e790c8 100644 --- a/aexpect/client.py +++ b/aexpect/client.py @@ -532,6 +532,7 @@ def __init__(self, command=None, a_id=None, auto_close=False, echo=False, :param encoding: Override text encoding (by default: autodetect by locale.getpreferredencoding()) """ + self.tail_thread = None # Add a reader and a close hook self._add_reader("tail") self._add_close_hook(Tail._join_thread) @@ -552,7 +553,6 @@ def __init__(self, command=None, a_id=None, auto_close=False, echo=False, self.output_prefix = output_prefix # Start the thread in the background - self.tail_thread = None if self.is_alive(): if termination_func or output_func: self._start_thread()