mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user