SpecModifierAlias: micro move (#5464)

It's needed to put spec modifier to the end of resolving.

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

Co-authored-by: a <1@1.1>
This commit is contained in:
Andy Kipp 2024-05-31 17:36:02 +02:00 committed by GitHub
parent aaf3c99a3b
commit 2908f4da17
Failed to generate hash of commit

View file

@ -705,7 +705,7 @@ class SubprocSpec:
def resolve_alias(self):
"""Sets alias in command, if applicable."""
cmd0 = self.cmd[0]
spec_modifiers = []
if cmd0 in self.alias_stack:
# Disabling the alias resolving to prevent infinite loop in call stack
# and futher using binary_loc to resolve the alias name.
@ -715,7 +715,6 @@ class SubprocSpec:
if callable(cmd0):
alias = cmd0
else:
spec_modifiers = []
if isinstance(XSH.aliases, dict):
# Windows tests
alias = XSH.aliases.get(cmd0, None)
@ -723,10 +722,10 @@ class SubprocSpec:
alias = XSH.aliases.get(cmd0, None, spec_modifiers=spec_modifiers)
if alias is not None:
self.alias_name = cmd0
if spec_modifiers:
for mod in spec_modifiers:
self.add_spec_modifier(mod)
self.alias = alias
if spec_modifiers:
for mod in spec_modifiers:
self.add_spec_modifier(mod)
def resolve_binary_loc(self):
"""Sets the binary location"""