mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
handle Ctrl+C more gracefully
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
__package__ = 'archivebox.cli'
|
__package__ = 'archivebox.cli'
|
||||||
__command__ = 'archivebox'
|
__command__ = 'archivebox'
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import threading
|
import threading
|
||||||
import tempfile
|
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
from rich import print
|
||||||
|
|
||||||
from typing import Optional, List, IO, Union, Iterable
|
from typing import Optional, List, IO, Union, Iterable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -242,8 +242,11 @@ def main(args: List[str] | Omitted=OMITTED, stdin: IO | Omitted=OMITTED, pwd: st
|
|||||||
stdin=stdin or None,
|
stdin=stdin or None,
|
||||||
)
|
)
|
||||||
|
|
||||||
run_subcommand(
|
try:
|
||||||
subcommand=command.subcommand,
|
run_subcommand(
|
||||||
subcommand_args=command.subcommand_args,
|
subcommand=command.subcommand,
|
||||||
stdin=stdin or None,
|
subcommand_args=command.subcommand_args,
|
||||||
)
|
stdin=stdin or None,
|
||||||
|
)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n\n[red][X] Got CTRL+C. Exiting...[/red]')
|
||||||
|
|||||||
Reference in New Issue
Block a user