aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-02-07 21:38:24 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-02-20 22:33:46 -0500
commit55abcbb8f60e1afe3af0133a6ff0e9dedc6df1b7 (patch)
tree5e2b5d8e2a47ebbc960b429b7bd4e8531e32f8a9
parentecb32bf457ed27b75c9b4386ca1acfbd4b63869e (diff)
downloadmeson-55abcbb8f60e1afe3af0133a6ff0e9dedc6df1b7.zip
meson-55abcbb8f60e1afe3af0133a6ff0e9dedc6df1b7.tar.gz
meson-55abcbb8f60e1afe3af0133a6ff0e9dedc6df1b7.tar.bz2
minstall: check 5 times for an answer to the elevation prompt
The user might press enter by accident and miss the message.
-rw-r--r--mesonbuild/minstall.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index a645960..698feef 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -566,10 +566,13 @@ class Installer:
if rootcmd is not None:
print('Installation failed due to insufficient permissions.')
- ans = input(f'Attempt to use {rootcmd} to gain elevated privileges? [y/n] ')
- if ans not in {'y', 'n'}:
+ for attempt in range(5):
+ ans = input(f'Attempt to use {rootcmd} to gain elevated privileges? [y/n] ')
+ if ans in {'y', 'n'}:
+ break
+ else:
raise MesonException('Answer not one of [y/n]')
- elif ans == 'y':
+ if ans == 'y':
os.execlp(rootcmd, rootcmd, sys.executable, main_file, *sys.argv[1:],
'-C', os.getcwd(), '--no-rebuild')
raise