Use sys.exit instead of exit (#4120)

This commit is contained in:
codefiles 2026-01-12 15:51:08 -05:00 committed by GitHub
parent 82512eed0e
commit f6eca309ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 20 additions and 13 deletions

View File

@ -48,7 +48,7 @@ def _check_online() -> None:
if not arch_config_handler.args.skip_wifi_check:
success = not wifi_handler.setup()
if not success:
exit(0)
sys.exit(0)
def _fetch_arch_db() -> None:
@ -63,7 +63,7 @@ def _fetch_arch_db() -> None:
error('Run archinstall --debug and check /var/log/archinstall/install.log for details.')
debug(f'Failed to sync Arch Linux package database: {e}')
exit(1)
sys.exit(1)
def check_version_upgrade() -> str | None:
@ -151,7 +151,7 @@ def run_as_a_module() -> None:
warn(text)
rc = 1
exit(rc)
sys.exit(rc)
__all__ = [

View File

@ -1,6 +1,7 @@
import argparse
import json
import os
import sys
import urllib.error
import urllib.parse
from argparse import ArgumentParser, Namespace
@ -266,7 +267,7 @@ class ArchConfigHandler:
self._config.version = self._get_version()
except ValueError as err:
warn(str(err))
exit(1)
sys.exit(1)
@property
def config(self) -> ArchConfig:
@ -492,7 +493,7 @@ class ArchConfigHandler:
except ValueError as err:
if 'Invalid password' in str(err):
error(tr('Incorrect credentials file decryption password'))
exit(1)
sys.exit(1)
else:
debug(f'Error decrypting credentials file: {err}')
raise err from err
@ -537,12 +538,12 @@ class ArchConfigHandler:
else:
error('Not a valid url')
exit(1)
sys.exit(1)
def _read_file(self, path: Path) -> str:
if not path.exists():
error(f'Could not find file {path}')
exit(1)
sys.exit(1)
return path.read_text()

View File

@ -1,3 +1,4 @@
import sys
from typing import override
from archinstall.lib.disk.disk_menu import DiskLayoutConfigurationMenu
@ -174,7 +175,7 @@ class GlobalMenu(AbstractMenu[None]):
),
MenuItem(
text=tr('Abort'),
action=lambda x: exit(1),
action=lambda x: sys.exit(1),
key=f'{CONFIG_KEY}_abort',
),
]

View File

@ -1,3 +1,4 @@
import sys
from enum import Enum
from pathlib import Path
from typing import assert_never
@ -305,4 +306,4 @@ def ask_abort() -> None:
).run()
if result.item() == MenuItem.yes():
exit(0)
sys.exit(0)

View File

@ -1,3 +1,4 @@
import sys
import time
from collections.abc import Callable
from pathlib import Path
@ -35,7 +36,7 @@ class Pacman:
if time.time() - started > (60 * 10):
error(tr('Pre-existing pacman lock never exited. Please clean up any existing pacman sessions before using archinstall.'))
exit(1)
sys.exit(1)
return SysCommand(f'{default_cmd} {args}')

View File

@ -1,4 +1,5 @@
import os
import sys
import time
from pathlib import Path
@ -194,7 +195,7 @@ def guided() -> None:
config.save()
if arch_config_handler.args.dry_run:
exit(0)
sys.exit(0)
if not arch_config_handler.args.silent:
aborted = False

View File

@ -1,3 +1,4 @@
import sys
from pathlib import Path
from archinstall.default_profiles.minimal import MinimalProfile
@ -69,7 +70,7 @@ def _minimal() -> None:
config.save()
if arch_config_handler.args.dry_run:
exit(0)
sys.exit(0)
if not arch_config_handler.args.silent:
aborted = False

View File

@ -1,3 +1,4 @@
import sys
from pathlib import Path
from archinstall import debug, error
@ -65,7 +66,7 @@ def _only_hd() -> None:
config.save()
if arch_config_handler.args.dry_run:
exit(0)
sys.exit(0)
if not arch_config_handler.args.silent:
aborted = False