Skip to content

Commit fa0ced6

Browse files
authored
Merge pull request #468 from sampsyo/brench-single-cmd-pipeline
Brench: Fix crash when using a single command
2 parents 65e4f46 + 8e877b0 commit fa0ced6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

brench/brench.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ def run_pipe(cmds, input, timeout):
4141

4242
try:
4343
# Send stdin and collect stdout.
44-
procs[0].stdin.write(input)
45-
procs[0].stdin.close()
46-
return procs[-1].communicate(timeout=timeout)
44+
if len(procs) == 1:
45+
return procs[0].communicate(input=input, timeout=timeout)
46+
else:
47+
procs[0].stdin.write(input)
48+
procs[0].stdin.close()
49+
return procs[-1].communicate(timeout=timeout)
4750
finally:
4851
for proc in procs:
4952
proc.kill()

0 commit comments

Comments
 (0)