diff --git a/utils/build-script b/utils/build-script index 275eff8451ca5..0efc8a590f8d4 100755 --- a/utils/build-script +++ b/utils/build-script @@ -184,28 +184,6 @@ def tar(source, destination): shell.call(args + [source], stderr=shell.DEVNULL) -def process_system_exit(e: SystemExit) -> int: - # According to Python's documents, `SystemExit.code` is the exit status - # or error message that is passed to the constructor. (Defaults to None.) - # - # This means that `SystemExit.code` is either `None`, an `int` object or - # a `string` object of error message. - if e.code is None: - # Fallback to 1 if there is no error code but a `SystemExit`. - return 1 - try: - numeric_code = int(e.code) - return numeric_code - except ValueError: - # Fallback to 1 if it is an error message and print that message. - print(e) - return 1 - finally: - # Fallback to 1 and do nothing, since there is only ValueError as - # expected exception. - return 1 - - # ----------------------------------------------------------------------------- # Argument Validation @@ -825,11 +803,12 @@ def main(): if __name__ == "__main__": try: exit_code = main() + log_analyzer() except SystemExit as e: - error_code = process_system_exit(e) - os._exit(error_code) + raise e except KeyboardInterrupt: sys.exit(1) - finally: + except: log_analyzer() + raise sys.exit(exit_code) diff --git a/utils/swift_build_support/swift_build_support/products/swiftformat.py b/utils/swift_build_support/swift_build_support/products/swiftformat.py index a17441fb55615..d48543d97ffc8 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftformat.py +++ b/utils/swift_build_support/swift_build_support/products/swiftformat.py @@ -137,13 +137,16 @@ def lint_swiftsyntax(self, host_target): shell.call(linting_cmd, env={'SWIFTCI_USE_LOCAL_DEPS': '1'}) def lint_sourcekitlsp(self): + format_path = os.path.join(self.build_dir, self.configuration(), 'swift-format') + lsp_path = os.path.join(os.path.dirname(self.source_dir), 'sourcekit-lsp') + shell.call([format_path, '-h']) linting_cmd = [ - os.path.join(self.build_dir, self.configuration(), 'swift-format'), + format_path, 'lint', '--parallel', '--strict', '--recursive', - os.path.join(os.path.dirname(self.source_dir), 'sourcekit-lsp'), + lsp_path, ] shell.call(linting_cmd)