mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 12:16:53 +00:00
revert checking for string and just pass a string to run() instead of a list
This commit is contained in:
parent
b98d036e06
commit
d8f2bd92b8
1 changed files with 2 additions and 4 deletions
|
|
@ -55,7 +55,7 @@ def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
|
|||
try:
|
||||
for file_ in files_modified:
|
||||
# get the staged version of the file
|
||||
gitcmd_getstaged = ["git", "show", ":%s" % file_]
|
||||
gitcmd_getstaged = "git show :%s" % file_
|
||||
_, out, _ = run(gitcmd_getstaged, raw_output=True, decode=False)
|
||||
# write the staged version to temp dir with its full path to
|
||||
# avoid overwriting files with the same name
|
||||
|
|
@ -107,9 +107,7 @@ def hg_hook(ui, repo, **kwargs):
|
|||
|
||||
|
||||
def run(command, raw_output=False, decode=True):
|
||||
if isinstance(command, basestring):
|
||||
command = command.split()
|
||||
p = Popen(command, stdout=PIPE, stderr=PIPE)
|
||||
p = Popen(command.split(), stdout=PIPE, stderr=PIPE)
|
||||
(stdout, stderr) = p.communicate()
|
||||
# On python 3, subprocess.Popen returns bytes objects which expect
|
||||
# endswith to be given a bytes object or a tuple of bytes but not native
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue