Skip to content

Commit 2fcb774

Browse files
committed
Run the code formatter on ExUnit.CaptureIO
1 parent ba450ca commit 2fcb774

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/ex_unit/lib/ex_unit/capture_io.ex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ defmodule ExUnit.CaptureIO do
104104
do_capture_io(map_dev(device), options, fun)
105105
end
106106

107-
defp map_dev(:stdio), do: :standard_io
107+
defp map_dev(:stdio), do: :standard_io
108108
defp map_dev(:stderr), do: :standard_error
109-
defp map_dev(other), do: other
109+
defp map_dev(other), do: other
110110

111111
defp do_capture_io(:standard_io, options, fun) do
112112
prompt_config = Keyword.get(options, :capture_prompt, true)
113113
input = Keyword.get(options, :input, "")
114114

115115
original_gl = Process.group_leader()
116116
{:ok, capture_gl} = StringIO.open(input, capture_prompt: prompt_config)
117+
117118
try do
118119
Process.group_leader(self(), capture_gl)
119120
do_capture_io(capture_gl, fun)
@@ -125,19 +126,22 @@ defmodule ExUnit.CaptureIO do
125126
defp do_capture_io(device, options, fun) do
126127
input = Keyword.get(options, :input, "")
127128
{:ok, string_io} = StringIO.open(input)
129+
128130
case ExUnit.CaptureServer.device_capture_on(device, string_io) do
129131
{:ok, ref} ->
130132
try do
131133
do_capture_io(string_io, fun)
132134
after
133135
ExUnit.CaptureServer.device_capture_off(ref)
134136
end
137+
135138
{:error, :no_device} ->
136139
_ = StringIO.close(string_io)
137-
raise "could not find IO device registered at #{inspect device}"
140+
raise "could not find IO device registered at #{inspect(device)}"
141+
138142
{:error, :already_captured} ->
139143
_ = StringIO.close(string_io)
140-
raise "IO device registered at #{inspect device} is already captured"
144+
raise "IO device registered at #{inspect(device)} is already captured"
141145
end
142146
end
143147

0 commit comments

Comments
 (0)