Fixed watch.py not updating when no output

We redraw the output when we recieve a new line from the child process.
Which means if we never recieve a new line, nothing gets drawn.

Fixed by adding an extra case after the child process finishes.
This commit is contained in:
Christopher Haster
2024-06-12 14:37:02 -05:00
parent a735bcd667
commit 692db1327e
+2 -2
View File
@@ -218,7 +218,7 @@ def main(command, *,
if not line: if not line:
break break
if cat or not head or len(ring) < h: if cat or not head or (head and len(ring) < h):
ring.write(line) ring.write(line)
if not cat and not buffer and not ignore_errors: if not cat and not buffer and not ignore_errors:
ring.draw() ring.draw()
@@ -226,7 +226,7 @@ def main(command, *,
mpty.close() mpty.close()
proc.wait() proc.wait()
if ((buffer or ignore_errors) if ((buffer or ignore_errors or (not cat and len(ring) == 0))
and not (ignore_errors and proc.returncode != 0)): and not (ignore_errors and proc.returncode != 0)):
ring.draw() ring.draw()
if exit_on_error and proc.returncode != 0: if exit_on_error and proc.returncode != 0: