our_knp/examples/tools/hooks/tools_lib/static_analyzer_cmd.py
int 8f43927575 Initial import: KNP experiments (examples, viz, cats-dogs, reports)
examples/ is based on KasperskyLab/knp at 55470ed6 with local changes
to the mnist-learn altai/blifat models, cuda-backend CMake and model_loader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 18:17:15 +03:00

25 lines
842 B
Python

import subprocess as sp
import sys
from typing import List
from .command import Command
class StaticAnalyzerCmd(Command):
"""Commmands that analyze code and are not formatters.s"""
def __init__(self, command: str, look_behind: str, args: List[str]):
super().__init__(command, look_behind, args)
def run_command(self, args: List[str]):
"""Run the command and check for errors. Arguments include options and filepaths."""
args = [self.command, *args]
sp_child = sp.run(args, stdout=sp.PIPE, stderr=sp.PIPE)
self.stdout += sp_child.stdout
self.stderr += sp_child.stderr
self.returncode = sp_child.returncode
def exit_on_error(self):
if self.returncode != 0:
sys.stderr.buffer.write(self.stdout + self.stderr)
sys.exit(self.returncode)