Skip to content

Commit

Permalink
fix issue for weird error in first question due to the systematic run…
Browse files Browse the repository at this point in the history
…ning of postcmd
  • Loading branch information
oliviermattelaer committed Jul 26, 2023
1 parent 6686644 commit 2537b6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion madgraph/interface/extended_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ def ask(self, question, default, choices=[], path_msg=None,
question_instance = obj(question, allow_arg=choices, default=default,
mother_interface=self, **opt)
if fct_timeout is None:
fct_timeout = lambda x: question_instance.postcmd(x, default) if x else False
fct_timeout = lambda x: question_instance.postcmd(x, default) if x and default else False
if first_cmd:
if isinstance(first_cmd, str):
question_instance.onecmd(first_cmd)
Expand Down Expand Up @@ -2274,6 +2274,9 @@ def postcmd(self, stop, line):
if n:
self.default(line)
return self.postcmd(stop, line)
elif self.value is None and line:
self.default(line)
return self.postcmd(stop, line)
if not self.casesensitive:
for ans in self.allow_arg:
if ans.lower() == self.value.lower():
Expand Down

0 comments on commit 2537b6c

Please sign in to comment.