Skip to content

Commit 5729b43

Browse files
redsun82Copilot
andcommitted
Just: flush the account of what runs before a child writes over it
`error` says why already: the streams are buffered differently when they are not both a terminal. The same holds where a child inherits this process' stdout, and there it was missed, so off a terminal the buffer flushed at exit and every account of what was about to run landed after the output it described. Visible only in redirected runs, which is to say in logs and never interactively. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent ff34138 commit 5729b43

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

misc/just/forward_command.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ def report_opted_out(command, justfiles, *, ran):
317317

318318
def invoke_just(cwd, args):
319319
"""Run just with the given arguments."""
320+
# This process' stdout is block-buffered off a terminal, while the child writes to the
321+
# same descriptor at once: without this the account lands after what it describes.
322+
sys.stdout.flush()
320323
try:
321324
subprocess.run([JUST, *args], check=True, cwd=cwd)
322325
except subprocess.CalledProcessError as e:

0 commit comments

Comments
 (0)