diff --git a/pyrevolve/tools.py b/pyrevolve/tools.py index b844794..950b5bf 100644 --- a/pyrevolve/tools.py +++ b/pyrevolve/tools.py @@ -48,12 +48,10 @@ def stop(self): """ Stop capturing the stream data and save the text in `capturedtext`. """ - # Print the escape character to make the readOutput method stop: - self.origstream.write(self.escape_char) + os.write(self.pipe_in, self.escape_char.encode()) # Flush the stream to make sure all our data goes in before # the escape character: - self.origstream.flush() if self.threaded: # wait until the thread finishes so we are sure that # we have until the last character: @@ -74,7 +72,7 @@ def readOutput(self): and save the text in `capturedtext`. """ while True: - char = os.read(self.pipe_out, 1).decode(self.origstream.encoding) + char = os.read(self.pipe_out, 1).decode() if not char or self.escape_char in char: break self.capturedtext += char