Skip to content

Commit

Permalink
Merge 4c5ea87 into 40fcd27
Browse files Browse the repository at this point in the history
  • Loading branch information
vient committed Oct 31, 2023
2 parents 40fcd27 + 4c5ea87 commit 1f2acca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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
8 changes: 7 additions & 1 deletion tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,19 +607,25 @@ def test_iter_lines_line_timeout(self):

@skip_on_windows
def test_modifiers(self):
from plumbum.cmd import grep, ls
from plumbum.cmd import cat, grep, ls

f = (ls["-a"] | grep["\\.py"]) & BG
f.wait()
assert "test_local.py" in f.stdout.splitlines()

command = ls["-a"] | grep["local"]
command_false = ls["-a"] | grep["not_a_file_here"]
command_false_2 = command_false | cat
command & FG
assert command & TF
assert not (command_false & TF)
assert not (command_false_2 & TF)
assert command & RETCODE == 0
assert command_false & RETCODE == 1
assert command_false_2 & RETCODE == 1
assert (command & TEE)[0] == 0
assert (command_false & TEE(retcode=None))[0] == 1
assert (command_false_2 & TEE(retcode=None))[0] == 1

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

0 comments on commit 1f2acca

Please sign in to comment.