diff options
author | José Valim <jose.valim@dashbit.co> | 2021-12-11 21:30:11 +0100 |
---|---|---|
committer | José Valim <jose.valim@dashbit.co> | 2021-12-11 21:30:11 +0100 |
commit | 353eafb259954d080cb595cc599a1634471cca88 (patch) | |
tree | 519f0d1936dd8a90c012e52182161ae231fbb13d | |
parent | b1bfd1fa0a1c44fb20d3fb7f198973e60af331a2 (diff) | |
download | elixir-353eafb259954d080cb595cc599a1634471cca88.tar.gz |
Consistently halt with 1 on standalone options
-rw-r--r-- | lib/elixir/lib/kernel/cli.ex | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/elixir/lib/kernel/cli.ex b/lib/elixir/lib/kernel/cli.ex index ce24c426c..e84aa7c01 100644 --- a/lib/elixir/lib/kernel/cli.ex +++ b/lib/elixir/lib/kernel/cli.ex @@ -218,13 +218,13 @@ defmodule Kernel.CLI do # Parse shared options - defp warn_standalone(opt) do + defp halt_standalone(opt) do IO.puts(:stderr, "#{opt} : Standalone options can't be combined with other options") + System.halt(1) end defp parse_shared([opt | _], _config) when opt in @standalone_opts do - warn_standalone(opt) - System.halt(1) + halt_standalone(opt) end defp parse_shared([opt | t], _config) when opt in ["-v", "--version"] do @@ -235,8 +235,11 @@ defmodule Kernel.CLI do IO.puts("Elixir " <> System.build_info()[:build]) end - t != [] && warn_standalone(opt) - System.halt(0) + if t != [] do + halt_standalone(opt) + else + System.halt(0) + end end defp parse_shared(["-pa", h | t], config) do |