Coding style.
This commit is contained in:
parent
2b57080af3
commit
5949a82c2d
1 changed files with 10 additions and 12 deletions
|
|
@ -4,7 +4,6 @@
|
|||
# Licensed under the Artistic License 2.0.
|
||||
|
||||
import ast
|
||||
import asyncio
|
||||
import contextlib
|
||||
import enum
|
||||
import functools
|
||||
|
|
@ -116,9 +115,9 @@ def _run_command(command, success_status=None, error_status=None,
|
|||
process = subprocess.run(command, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, text=True,
|
||||
timeout=timeout)
|
||||
stdout, stderr, returncode = (termstr.TermStr.from_term(process.stdout),
|
||||
termstr.TermStr.from_term(process.stderr),
|
||||
process.returncode)
|
||||
stdout, stderr, returncode = (
|
||||
termstr.TermStr.from_term(process.stdout),
|
||||
termstr.TermStr.from_term(process.stderr), process.returncode)
|
||||
else:
|
||||
stdout, stderr, returncode = _do_command(command, timeout=timeout)
|
||||
result_status = success_status if returncode == 0 else error_status
|
||||
|
|
@ -679,16 +678,15 @@ def tools_for_path(path):
|
|||
|
||||
def run_tool_no_error(path, tool):
|
||||
try:
|
||||
status, result = tool(path)
|
||||
return tool(path)
|
||||
except subprocess.TimeoutExpired:
|
||||
status, result = Status.timed_out, "Timed out"
|
||||
return Status.timed_out, "Timed out"
|
||||
except UnicodeDecodeError:
|
||||
status, result = Status.not_applicable, "Result not in UTF-8"
|
||||
except:
|
||||
status, result = Status.error, _syntax_highlight(
|
||||
return Status.not_applicable, "Result not in UTF-8"
|
||||
except Exception:
|
||||
return Status.error, _syntax_highlight(
|
||||
traceback.format_exc(), pygments.lexers.PythonTracebackLexer(),
|
||||
pygments.styles.get_style_by_name(os.environ["PYGMENT_STYLE"]))
|
||||
return status, result
|
||||
|
||||
|
||||
def _convert_lscolor_code_to_charstyle(lscolor_code):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue