Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Use check_output when merging. #14465

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions scripts/merge-py.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

from __future__ import print_function

from subprocess import check_output
from requests.auth import HTTPBasicAuth
import requests

import os
import six
import subprocess
import sys
import textwrap

Expand Down Expand Up @@ -83,21 +83,10 @@ def fail(msg):


def run_cmd(cmd):
# py2.6 does not have subprocess.check_output
if isinstance(cmd, six.string_types):
cmd = cmd.split(' ')

popenargs = [cmd]
kwargs = {}

process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
raise subprocess.CalledProcessError(retcode, cmd, output=output)
output = check_output(cmd)

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