File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import os
1010import re
1111import subprocess
12+ from subprocess import check_output
1213import sys
1314import warnings
1415from textwrap import fill
1920PY3 = (sys .version_info [0 ] >= 3 )
2021
2122
22- try :
23- from subprocess import check_output
24- except ImportError :
25- # check_output is not available in Python 2.6
26- def check_output (* popenargs , ** kwargs ):
27- """
28- Run command with arguments and return its output as a byte
29- string.
30-
31- Backported from Python 2.7 as it's implemented as pure python
32- on stdlib.
33- """
34- process = subprocess .Popen (
35- stdout = subprocess .PIPE , * popenargs , ** kwargs )
36- output , unused_err = process .communicate ()
37- retcode = process .poll ()
38- if retcode :
39- cmd = kwargs .get ("args" )
40- if cmd is None :
41- cmd = popenargs [0 ]
42- error = subprocess .CalledProcessError (retcode , cmd )
43- error .output = output
44- raise error
45- return output
46-
47-
4823if sys .platform != 'win32' :
4924 if sys .version_info [0 ] < 3 :
5025 from commands import getstatusoutput
You can’t perform that action at this time.
0 commit comments