python: Replace os.system with subprocess.call.

Generally, we avoid os.system, since it shells out and thus can be
a cause of security issues.
This commit is contained in:
rht
2017-05-24 08:46:44 +02:00
committed by Tim Abbott
parent bb329b4020
commit a1f82e02d6
3 changed files with 6 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ from .template_parser import (
is_django_block_tag,
)
from six.moves import range
import os
import subprocess
def pretty_print_html(html, num_spaces=4):
# type: (str, int) -> str
@@ -181,6 +181,6 @@ def validate_indent_html(fn):
temp_file.write(phtml)
temp_file.close()
print('Invalid Indentation detected in file: %s\nDiff for the file against expected indented file:' % (fn))
os.system('diff %s %s' % (fn, '/var/tmp/pretty_html.txt'))
subprocess.call(['diff', fn, '/var/tmp/pretty_html.txt'], stderr=subprocess.STDOUT)
return 0
return 1