Skip to content

Commit 8f54e35

Browse files
gfyoungjreback
authored andcommitted
MAINT: Use check_output when merging.
Since we don't support Python 2.6 anymore, the `check_output` method from `subprocess` is at our disposal. Follow-up to #14447. xref <a href="https://github.com/pandas- dev/pandas/issues/14439#issuecomment-254522055"> #14439 (comment)</a> Author: gfyoung <[email protected]> Closes #14465 from gfyoung/merge-pr-refactor and squashes the following commits: e267d2b [gfyoung] MAINT: Use check_output when merging.
1 parent 233d51d commit 8f54e35

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

scripts/merge-py.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626
from __future__ import print_function
2727

28+
from subprocess import check_output
2829
from requests.auth import HTTPBasicAuth
2930
import requests
3031

3132
import os
3233
import six
33-
import subprocess
3434
import sys
3535
import textwrap
3636

@@ -83,21 +83,10 @@ def fail(msg):
8383

8484

8585
def run_cmd(cmd):
86-
# py2.6 does not have subprocess.check_output
8786
if isinstance(cmd, six.string_types):
8887
cmd = cmd.split(' ')
8988

90-
popenargs = [cmd]
91-
kwargs = {}
92-
93-
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs)
94-
output, unused_err = process.communicate()
95-
retcode = process.poll()
96-
if retcode:
97-
cmd = kwargs.get("args")
98-
if cmd is None:
99-
cmd = popenargs[0]
100-
raise subprocess.CalledProcessError(retcode, cmd, output=output)
89+
output = check_output(cmd)
10190

10291
if isinstance(output, six.binary_type):
10392
output = output.decode('utf-8')

0 commit comments

Comments
 (0)