Skip to content

Commit

Permalink
fix: make it easier to abort ongoing operation
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed May 7, 2022
1 parent 72a6a97 commit 830dc92
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions csv2notion/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import argparse
import logging
import os
import signal
import sys
from functools import partial
from pathlib import Path
Expand Down Expand Up @@ -312,7 +314,14 @@ def critical_error(msg: str) -> None:
sys.exit(1)


def abort(*args): # pragma: no cover
print("\nAbort")
os._exit(1)


def main() -> None:
signal.signal(signal.SIGINT, abort)

try:
cli(sys.argv[1:])
except (NotionError, CriticalError) as e:
Expand Down

0 comments on commit 830dc92

Please sign in to comment.