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

Feature/replace check output #4854

merged 14 commits into from Mar 28, 2019
@@ -3,9 +3,11 @@
import platform
import subprocess
import sys
import tempfile
from subprocess import CalledProcessError, PIPE

from import which
from import environment_append
from import load, which
from conans.errors import ConanException
from conans.model.version import Version
from conans.util.fallbacks import default_output
@@ -432,3 +434,24 @@ def get_gnu_triplet(os_, arch, compiler=None):
op_system += "_ilp32" #

return "%s-%s" % (machine, op_system)

def check_output(cmd, folder=None, return_code=False):
tmp_file = tempfile.mktemp()
process = subprocess.Popen("{} > {}".format(cmd, tmp_file), shell=True, stderr=PIPE, cwd=folder)

if return_code:
return process.returncode

if process.returncode:
raise CalledProcessError(process.returncode, cmd)

output = load(tmp_file)
return output
@@ -1,4 +1,3 @@

import os
import platform
import re
@@ -8,6 +7,7 @@

from six.moves.urllib.parse import quote_plus, unquote, urlparse

from import check_output
from import environment_append, no_op
from import chdir
from conans.errors import ConanException
@@ -53,7 +53,7 @@ def run(self, command):
with chdir(self.folder) if self.folder else no_op():
with environment_append({"LC_ALL": "en_US.UTF-8"}) if self._force_eng else no_op():
if not self._runner:
return decode_text(subprocess.check_output(command, shell=True, stderr=STDOUT).strip())
return check_output(command).strip()
return self._runner(command)

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.