Skip to content

Commit 547be43

Browse files
Revert "Ensure that exit code 0 is used for "stop" command"
This reverts commit 1518b60. There is no consensus on how it should work. In general it is impossible to tell a stopped node from a node we could not contact (with some specific exceptions reported by modern net_kernel version such as the Erlang cookie mismatch), so some believe stop should be idempotent and others believe it should not.
1 parent 644c9af commit 547be43

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/rabbit_cli.erl

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

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

0 commit comments

Comments
 (0)