skip confirmation if ran from CLI in a non-interactive context

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
This commit is contained in:
Axolotle 2022-12-04 13:24:47 +01:00 committed by GitHub
parent d4d739bbe2
commit b17e00c31e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2900,7 +2900,11 @@ def _ask_confirmation(
"""
if force or Moulinette.interface.type == "api":
return
# If ran from the CLI in a non-interactive context,
# skip confirmation (except in hard mode)
if not os.isatty(1) and kind in ["simple", "soft"]:
return
if kind == "simple":
answer = Moulinette.prompt(
m18n.n(question, answers="Press enter to continue", **params),