Pause scripts before closing
This commit is contained in:
+16
-1
@@ -1194,7 +1194,15 @@ def prepare_plan(records: list[MediaRecord], choices: UserChoices) -> list[list[
|
||||
return groups
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
def pause_if_interactive() -> None:
|
||||
if sys.stdin.isatty():
|
||||
try:
|
||||
input("\nPress Enter to close...")
|
||||
except EOFError:
|
||||
pass
|
||||
|
||||
|
||||
def run(argv: list[str]) -> int:
|
||||
if len(argv) < 2:
|
||||
print("Usage: python3 photo_metadata.py path/to/file/or/directory [...]")
|
||||
return 2
|
||||
@@ -1254,5 +1262,12 @@ def main(argv: list[str]) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
try:
|
||||
return run(argv)
|
||||
finally:
|
||||
pause_if_interactive()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv))
|
||||
|
||||
Reference in New Issue
Block a user