@@ -23,11 +23,10 @@ defmodule ExUnit.CaptureIO do
23
23
Captures IO. Returns nil in case of no output,
24
24
otherwise returns the binary which is captured outputs.
25
25
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.
31
30
32
31
The input is mocked to return `:eof`.
33
32
@@ -41,15 +40,15 @@ defmodule ExUnit.CaptureIO do
41
40
true
42
41
43
42
"""
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
45
44
do_capture_io ( map_dev ( device ) , fun )
46
45
end
47
46
48
47
defp map_dev( :stdio ) , do: :standard_io
49
48
defp map_dev( :stderr ) , do: :standard_error
50
49
defp map_dev( other) , do: other
51
50
52
- defp do_capture_io( :group_leader , fun) do
51
+ defp do_capture_io( :standard_io , fun) do
53
52
original_gl = :erlang . group_leader
54
53
capture_gl = new_group_leader ( self )
55
54
:erlang . group_leader ( capture_gl , self )
0 commit comments