Skip to content

Commit 2ccd971

Browse files
Revert "Revert "Ensure that exit code 0 is used for "stop" command""
This reverts commit 547be43. The change in 1518b60 is in line with the expected stop behavior in 3.6.x. For 3.7.0 we are still contemplating what it should be.
1 parent 547be43 commit 2ccd971

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/rabbit_cli.erl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,12 @@ main(ParseFun, DoFun, UsageMod) ->
122122
_ ->
123123
print_error("unable to connect to node ~w: ~w", [Node, Reason]),
124124
print_badrpc_diagnostics([Node]),
125-
case Command of
126-
stop -> rabbit_misc:quit(?EX_OK);
127-
_ -> rabbit_misc:quit(?EX_UNAVAILABLE)
128-
end
125+
exit_badrpc(Command)
129126
end;
130127
{badrpc_multi, Reason, Nodes} ->
131128
print_error("unable to connect to nodes ~p: ~w", [Nodes, Reason]),
132129
print_badrpc_diagnostics(Nodes),
133-
rabbit_misc:quit(?EX_UNAVAILABLE);
130+
exit_badrpc(Command);
134131
function_clause ->
135132
print_error("operation ~w used with invalid parameter: ~p",
136133
[Command, Args]),
@@ -143,6 +140,11 @@ main(ParseFun, DoFun, UsageMod) ->
143140
rabbit_misc:quit(?EX_SOFTWARE)
144141
end.
145142

143+
exit_badrpc(stop) ->
144+
rabbit_misc:quit(?EX_OK);
145+
exit_badrpc(_) ->
146+
rabbit_misc:quit(?EX_UNAVAILABLE).
147+
146148
start_distribution_anon(0, LastError) ->
147149
{error, LastError};
148150
start_distribution_anon(TriesLeft, _) ->

0 commit comments

Comments
 (0)