Skip to content

Commit 55ec3c7

Browse files
committed
run: rename merged_capture→merge_out_err
This name better matches the purpose of this variable.
1 parent 12922e5 commit 55ec3c7

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/rift/Mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def _exec(self, cmd):
172172
cmd,
173173
live_output=logging.getLogger().isEnabledFor(logging.INFO),
174174
capture_output=True,
175-
merged_capture=True,
175+
merge_out_err=True,
176176
cwd='/'
177177
)
178178
if proc.returncode != 0:

lib/rift/run.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ def run_command(
5959
cmd,
6060
live_output=True,
6161
capture_output=False,
62-
merged_capture=False,
62+
merge_out_err=False,
6363
**kwargs
6464
):
6565
"""
6666
Run a command and return a RunResult named tuple. When live_output is True,
6767
command stdout/stderr are redirected to current process stdout/stderr. When
6868
capture_output is True, command stdout/stderr are available in out/err
69-
attributes of RunResult namedtuple. When merged_capture is True as well,
69+
attributes of RunResult namedtuple. When merge_out_err is True as well,
7070
command stderr is merged with stdout in out attribute of RunResult named
7171
tuple. In this case, err attribute is None.
7272
@@ -100,7 +100,7 @@ def run_command(
100100
# Initialize string buffers to store process output in memory
101101
buf_out = io.StringIO()
102102
buf_err = None
103-
if not merged_capture:
103+
if not merge_out_err:
104104
buf_err = io.StringIO()
105105

106106
# Process output lines handlers
@@ -111,7 +111,7 @@ def handle_stdout(stream):
111111
sys.stdout.write(line)
112112
def handle_stderr(stream):
113113
line = stream.readline()
114-
if merged_capture:
114+
if merge_out_err:
115115
buf_out.write(line)
116116
else:
117117
buf_err.write(line)
@@ -133,7 +133,7 @@ def handle_stderr(stream):
133133
if live_output:
134134
sys.stdout.write(line)
135135
for line in process.stderr:
136-
if merged_capture:
136+
if merge_out_err:
137137
buf_out.write(line)
138138
else:
139139
buf_err.write(line)
@@ -148,7 +148,7 @@ def handle_stderr(stream):
148148

149149
out = buf_out.getvalue()
150150
buf_out.close()
151-
if merged_capture:
151+
if merge_out_err:
152152
err = None
153153
else:
154154
err = buf_err.getvalue()

tests/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def test_run_command_capture_stderr(self, mock_stderr):
5555
@patch('sys.stderr', new_callable=StringIO)
5656
def test_run_command_capture_stderr_merged(self, mock_stderr):
5757
""" Test run_command() with merged error output capture. """
58-
proc = run_command("/bin/echo error_data 1>&2",
59-
capture_output=True, merged_capture=True, shell=True)
58+
proc = run_command("/bin/echo error_data 1>&2", capture_output=True,
59+
merge_out_err=True, shell=True)
6060
# With merged_capture, standard err must be available in out attribute
6161
# of RunResult named tuple, and err attribute must be None.
6262
self.assertEqual(proc.out, "error_data\n")
@@ -68,7 +68,7 @@ def test_run_command_capture_stderr_merged(self, mock_stderr):
6868
def test_run_command_capture_both_merged(self, mock_stderr):
6969
""" Test run_command() with merged error and standard output capture. """
7070
proc = run_command("/bin/echo error_data 1>&2 && /bin/echo output_data",
71-
capture_output=True, merged_capture=True, shell=True)
71+
capture_output=True, merge_out_err=True, shell=True)
7272
# With merge_out_err, standard err must be available in out attribute
7373
# of RunResult named tuple, and err attribute must be None.
7474
self.assertEqual(proc.out, "error_data\noutput_data\n")

0 commit comments

Comments
 (0)