fix(clip): properly set exit code (#35225)

fix: properly set exit code
pull/35230/head
Trey Moen 7 days ago committed by GitHub
parent 2ad501cc94
commit e8394a27d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      tools/clip/run.py

@ -5,6 +5,7 @@ import logging
import os
import platform
import shutil
import sys
import time
from argparse import ArgumentParser, ArgumentTypeError
from collections.abc import Sequence
@ -283,6 +284,7 @@ def main():
p.add_argument('-s', '--start', help='start clipping at <start> seconds', type=int)
p.add_argument('-t', '--title', help='overlay this title on the video (e.g. "Chill driving across the Golden Gate Bridge")', type=validate_title)
args = parse_args(p)
exit_code = 1
try:
clip(
data_dir=args.data_dir,
@ -295,12 +297,14 @@ def main():
target_mb=args.file_size,
title=args.title,
)
exit_code = 0
except KeyboardInterrupt as e:
logger.exception('interrupted by user', exc_info=e)
except Exception as e:
logger.exception('encountered error', exc_info=e)
finally:
atexit._run_exitfuncs()
sys.exit(exit_code)
if __name__ == '__main__':

Loading…
Cancel
Save