mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 03:34:18 +01:00
Fix truncation of error output in tests
This commit is contained in:
@@ -50,7 +50,8 @@ class LimboShell:
|
|||||||
return ""
|
return ""
|
||||||
self._write_to_pipe(f"SELECT '{end_marker}';")
|
self._write_to_pipe(f"SELECT '{end_marker}';")
|
||||||
output = ""
|
output = ""
|
||||||
while True:
|
done = False
|
||||||
|
while not done:
|
||||||
ready, _, errors = select.select(
|
ready, _, errors = select.select(
|
||||||
[self.pipe.stdout, self.pipe.stderr],
|
[self.pipe.stdout, self.pipe.stderr],
|
||||||
[],
|
[],
|
||||||
@@ -58,7 +59,7 @@ class LimboShell:
|
|||||||
)
|
)
|
||||||
ready_or_errors = set(ready + errors)
|
ready_or_errors = set(ready + errors)
|
||||||
if self.pipe.stderr in ready_or_errors:
|
if self.pipe.stderr in ready_or_errors:
|
||||||
self._handle_error()
|
done = self._handle_error()
|
||||||
if self.pipe.stdout in ready_or_errors:
|
if self.pipe.stdout in ready_or_errors:
|
||||||
fragment = self.pipe.stdout.read(PIPE_BUF).decode()
|
fragment = self.pipe.stdout.read(PIPE_BUF).decode()
|
||||||
output += fragment
|
output += fragment
|
||||||
@@ -71,17 +72,14 @@ class LimboShell:
|
|||||||
self.pipe.stdin.write((command + "\n").encode())
|
self.pipe.stdin.write((command + "\n").encode())
|
||||||
self.pipe.stdin.flush()
|
self.pipe.stdin.flush()
|
||||||
|
|
||||||
def _handle_error(self) -> None:
|
def _handle_error(self) -> bool:
|
||||||
while True:
|
while True:
|
||||||
ready, _, errors = select.select(
|
error_output = self.pipe.stderr.read(PIPE_BUF)
|
||||||
[self.pipe.stderr], [], [self.pipe.stderr], 0
|
if error_output == b"":
|
||||||
)
|
return True
|
||||||
if not (ready + errors):
|
print(error_output.decode(), end="")
|
||||||
break
|
return False
|
||||||
error_output = self.pipe.stderr.read(PIPE_BUF).decode()
|
|
||||||
print(error_output, end="")
|
|
||||||
raise RuntimeError("Error encountered in Limbo shell.")
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _clean_output(output: str, marker: str) -> str:
|
def _clean_output(output: str, marker: str) -> str:
|
||||||
output = output.rstrip().removesuffix(marker)
|
output = output.rstrip().removesuffix(marker)
|
||||||
|
|||||||
Reference in New Issue
Block a user