When PiSi CLI asks you a question, it doesn't flush its input
buffer, causing characters typed before the question prompt to be
handled like the answer.
Example:
$ sudo pisi it clisp -vd
(I mistakenly typed another character or hitted enter a second time,
now stdin contains something..)
aDEBUG: InstallDB initialized in 0.213829994202. (NOTE THE 'a' CHARACTER)
DEBUG: RepoDB initialized in 0.000118017196655.
DEBUG: ComponentDB initialized in 0.55585193634.
digraph G {
}
DEBUG: PackageDB initialized in 1.42305612564.
DEBUG: checking libsigsegv
DEBUG: checking ffcall
DEBUG: checking libXpm
digraph G {
ffcall[ label = "ffcall(1.10,1)" ];
clisp[ label = "clisp(2.47,6)" ];
clisp -> ffcall;
}
Bağımlılıkları sağlamak için bu paketler verilen sırada kurulacaktır:
ffcall clisp
Paket(ler)in toplam boyu: 2.66 MB
Bağımlılıklar yüzünden ek paketler var. Devam etmek istiyor musunuz? (evet/hayır)e
$
Eventhough I typed 'e' to the question, because of the 'a' character found in stdin,
PiSi thinks that the user answered with an 'a'.
--
This is now fixed by flushing the input buffer just before a confirmation question.
This commit is contained in:
@@ -108,9 +108,10 @@ class CLI(pisi.ui.UI):
|
||||
if ctx.config.options and ctx.config.options.yes_all:
|
||||
return True
|
||||
while True:
|
||||
import re
|
||||
import re, tty
|
||||
yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))
|
||||
|
||||
tty.tcflush(sys.stdin.fileno(), 0)
|
||||
prompt = msg + pisi.util.colorize(_(' (yes/no)'), 'red')
|
||||
s = raw_input(prompt.encode('utf-8'))
|
||||
if yesexpr.search(s):
|
||||
|
||||
Reference in New Issue
Block a user