Skip to content

Commit f14ed66

Browse files
authored
Don't exit immediately if running a command under alias mode (#3353)
There's a difference in behavior when an external command is run under the default mode vs when it is run under the alias mode. In the default mode, execution control returns to the caller unless the command had a non-zero exit code. In the alias mode, regardless of exit code, the Python script exits. This may result in some tasks not completing. Fix this by not unconditionally exiting if running a command in the alias mode. Note that there are other differences still present, but this fixes at least this one. Signed-off-by: Saikrishna Arcot <[email protected]>
1 parent 676ebe4 commit f14ed66

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

utilities_common/cli.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,7 @@ def run_command(command, display_cmd=False, ignore_error=False, return_cmd=False
731731
# with a list for next hops
732732
if (get_interface_naming_mode() == "alias" and not command_str.startswith("intfutil") and not re.search(
733733
"show ip|ipv6 route", command_str)):
734-
run_command_in_alias_mode(command, shell=shell)
735-
sys.exit(0)
734+
return run_command_in_alias_mode(command, shell=shell)
736735

737736
proc = subprocess.Popen(command, shell=shell, text=True, stdout=subprocess.PIPE)
738737

0 commit comments

Comments
 (0)