-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
45 lines (34 loc) · 1.04 KB
/
Copy pathbuild.py
File metadata and controls
45 lines (34 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (c) 2025 bladeacer
# Licensed under the GPLv3 License. See LICENSE file for details.
import os
import sys
from typing import Dict, Any
from pdf_fmt.startup import check_not_root, StartupCheckError
def main():
"""Main execution logic for the local script."""
try:
check_not_root()
except StartupCheckError as e:
print(e.message)
sys.exit(e.exit_code)
except Exception as e:
print(f"Unknown error: {e}")
sys.exit(1)
try:
from pdf_fmt import config
from pdf_fmt.parser import execute_main_pipeline
CONFIG: Dict[str, Any] = config.load_config()
execute_main_pipeline(CONFIG)
except StartupCheckError as e:
print(e.message)
sys.exit(e.exit_code)
except BrokenPipeError:
devnull = os.open(os.devnull, os.O_WRONLY)
os.dup2(devnull, sys.stdout.fileno())
sys.stdout.close()
os._exit(0)
except Exception as e:
print(f"Unknown error: {e}")
sys.exit(1)
if __name__ == "__main__":
main()