Files
cutdex/tool/common/process.py
T
lingjhf 152c051a29
Gitea CI / Check code and tests (pull_request) Failing after 8m56s
Gitea CI / Build Android APK (pull_request) Skipped
Gitea CI / Build Windows x64 app (pull_request) Skipped
Gitea CI / Audit and package Windows x64 (pull_request) Skipped
Gitea CI / Assemble and validate CI artifacts (pull_request) Skipped
Gitea CI / Gitea CI passed (pull_request) Failing after 4s
refactor(build): unify SDK configuration and release tooling
Pin Flutter with FVM and share local environment loading across IDE, Python, and Dart entrypoints. Keep CI on the verified preinstalled SDK and skip local overrides.

Extract common build presets, process execution, and file hashing. Propagate project roots through SDK selection and release commands, and migrate macOS release, signing, and DMG orchestration to Python.

Reuse local check suites in CI, support Android source overrides, and update documentation and regression tests.
2026-10-06 22:24:32 +08:00

32 lines
1.1 KiB
Python

"""Run argument vectors and report failures without logging credentials."""
from pathlib import Path
import subprocess
import sys
ROOT = Path(__file__).resolve().parents[2]
def run(command, *, cwd=ROOT, env=None, check=True, timeout=None, **kwargs):
return subprocess.run(list(map(str, command)), cwd=cwd, env=env,
check=check, timeout=timeout, **kwargs)
def cli(main):
"""Shared exit contract; argparse continues to own help and usage errors."""
try:
return main() or 0
except subprocess.CalledProcessError as error:
print(f'Command failed (exit {error.returncode}).', file=sys.stderr)
return error.returncode
except subprocess.TimeoutExpired:
print('Command timed out.', file=sys.stderr)
return 1
except (RuntimeError, ValueError) as error:
print(error, file=sys.stderr)
return 1
except OSError:
print('Required tool or file is unavailable; check paths and permissions.', file=sys.stderr)
return 1
except KeyboardInterrupt:
return 130