Skip to content

Commit 80633a2

Browse files
author
José Valim
committed
Use :stdio as default argument in capture_io
1 parent b5d20d3 commit 80633a2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/ex_unit/lib/ex_unit/capture_io.ex

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ defmodule ExUnit.CaptureIO do
2323
Captures IO. Returns nil in case of no output,
2424
otherwise returns the binary which is captured outputs.
2525
26-
By default, capture_io replaces the group_leader for
27-
the current process. However, the capturing of `:stdio`
28-
and `:stderr` is also possible globally by passing
29-
those devices (or any other registered device) explicitly
30-
as argument.
26+
By default, capture_io replaces the group_leader (`:stdio`)
27+
for the current process. However, the capturing of any other
28+
named device like `:stderr` is also possible globally by
29+
giving the registered device name explicitly as argument.
3130
3231
The input is mocked to return `:eof`.
3332
@@ -41,15 +40,15 @@ defmodule ExUnit.CaptureIO do
4140
true
4241
4342
"""
44-
def capture_io(device // :group_leader, fun) when is_atom(device) do
43+
def capture_io(device // :stdio, fun) when is_atom(device) do
4544
do_capture_io(map_dev(device), fun)
4645
end
4746

4847
defp map_dev(:stdio), do: :standard_io
4948
defp map_dev(:stderr), do: :standard_error
5049
defp map_dev(other), do: other
5150

52-
defp do_capture_io(:group_leader, fun) do
51+
defp do_capture_io(:standard_io, fun) do
5352
original_gl = :erlang.group_leader
5453
capture_gl = new_group_leader(self)
5554
:erlang.group_leader(capture_gl, self)

0 commit comments

Comments
 (0)