Skip to content

Commit b558142

Browse files
committed
Rename exit_code to exit_status for consistency
1 parent d7f96d8 commit b558142

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

bin/elixirc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Usage: $(basename "$0") [elixir switches] [compiler switches] [.ex files]
1414
--no-docs Does not attach documentation to compiled modules
1515
--profile time Profile the time to compile modules
1616
--verbose Prints compilation status
17-
--warnings-as-errors Treats warnings as errors and return non-zero exit code
17+
--warnings-as-errors Treats warnings as errors and return non-zero exit status
1818
1919
Options given after -- are passed down to the executed code.
2020
Options can be passed to the Erlang runtime using \$ELIXIR_ERL_OPTIONS.

bin/elixirc.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ echo --no-debug-info Does not attach debug info to compiled modules
2323
echo --no-docs Does not attach documentation to compiled modules
2424
echo --profile time Profile the time to compile modules
2525
echo --verbose Prints compilation status
26-
echo --warnings-as-errors Treats warnings as errors and returns non-zero exit code
26+
echo --warnings-as-errors Treats warnings as errors and returns non-zero exit status
2727
echo.
2828
echo ** Options given after -- are passed down to the executed code
2929
echo ** Options can be passed to the Erlang runtime using ELIXIR_ERL_OPTIONS

lib/mix/lib/mix.ex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,25 +433,26 @@ defmodule Mix do
433433
end
434434

435435
@doc """
436-
Raises a Mix error that is nicely formatted, defaulting to exit code `1`.
436+
Raises a Mix error that is nicely formatted, defaulting to exit status `1`.
437437
"""
438438
@spec raise(binary) :: no_return
439439
def raise(message) do
440-
__MODULE__.raise(message, exit_code: 1)
440+
__MODULE__.raise(message, exit_status: 1)
441441
end
442442

443443
@doc """
444444
Raises a Mix error that is nicely formatted.
445445
446446
## Options
447447
448-
* `:exit_code` - defines exit code value, defaults to `1`
448+
* `:exit_status` - defines exit status, defaults to `1`
449449
450450
"""
451-
@doc since: "1.12.0"
452-
@spec raise(binary, exit_code: non_neg_integer()) :: no_return
451+
@doc since: "1.12.3"
452+
@spec raise(binary, exit_status: non_neg_integer()) :: no_return
453453
def raise(message, opts) when is_binary(message) and is_list(opts) do
454-
Kernel.raise(Mix.Error, mix: Keyword.get(opts, :exit_code, 1), message: message)
454+
status = opts[:exit_status] || opts[:exit_code] || 1
455+
Kernel.raise(Mix.Error, mix: status, message: message)
455456
end
456457

457458
@doc """

lib/mix/lib/mix/tasks/compile.elixir.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ defmodule Mix.Tasks.Compile.Elixir do
5252
* `--debug-info` (`--no-debug-info`) - attaches (or not) debug info to compiled modules
5353
* `--ignore-module-conflict` - does not emit warnings if a module was previously defined
5454
* `--warnings-as-errors` - treats warnings in the current project as errors and
55-
return a non-zero exit code
55+
return a non-zero exit status
5656
* `--long-compilation-threshold N` - sets the "long compilation" threshold
5757
(in seconds) to `N` (see the docs for `Kernel.ParallelCompiler.compile/2`)
5858
* `--profile` - if set to `time`, outputs timing information of compilation steps

lib/mix/lib/mix/tasks/test.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ defmodule Mix.Tasks.Test do
174174
Note that in trace mode test timeouts will be ignored as timeout is set to `:infinity`
175175
176176
* `--warnings-as-errors` - (since v1.12.0) treats warnings as errors and returns a non-zero
177-
exit code. This option only applies to test files. To treat warnings as errors during
177+
exit status. This option only applies to test files. To treat warnings as errors during
178178
compilation and during tests, run:
179179
MIX_ENV=test mix do compile --warnings-as-errors, test --warnings-as-errors
180180

lib/mix/test/mix/cli_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defmodule Mix.CLITest do
2020
end
2121

2222
@tag :unix
23-
test "Mix.raise/2 can set exit code", %{tmp_dir: tmp_dir} do
23+
test "Mix.raise/2 can set exit status", %{tmp_dir: tmp_dir} do
2424
File.cd!(tmp_dir, fn ->
2525
File.mkdir_p!("lib")
2626

@@ -34,7 +34,7 @@ defmodule Mix.CLITest do
3434
3535
defp aliases do
3636
[
37-
custom: &error(&1, exit_code: 99),
37+
custom: &error(&1, exit_status: 99),
3838
]
3939
end
4040

0 commit comments

Comments
 (0)