Skip to content

Commit

Permalink
Fix missing non-zero return code from TEE'd pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
vient authored Oct 31, 2023
1 parent 40fcd27 commit c2ce578
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions plumbum/commands/modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def __rand__(self, cmd):

buf.append(data)

p.wait() # To get return code in p
stdout = "".join([x.decode("utf-8") for x in outbuf])
stderr = "".join([x.decode("utf-8") for x in errbuf])
return p.returncode, stdout, stderr
Expand Down
2 changes: 2 additions & 0 deletions tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ def test_modifiers(self):
assert not (command_false & TF)
assert command & RETCODE == 0
assert command_false & RETCODE == 1
assert (command & TEE)[0] == 0
assert (command_false & TEE(retcode=None))[0] == 1

@skip_on_windows
def test_tee_modifier(self, capfd):
Expand Down

0 comments on commit c2ce578

Please sign in to comment.