Skip to content

Commit b0bc02e

Browse files
author
José Valim
committed
Do not call :io.columns if width is set
1 parent a7ffebc commit b0bc02e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/elixir/lib/io.ex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ defmodule IO do
153153
"""
154154
def inspect(device, item, opts) when is_list(opts) do
155155
opts = Keyword.put_new(opts, :pretty, true)
156-
opts = case :io.columns(device) do
157-
{ :ok, width } -> Keyword.put_new(opts, :width, width)
158-
{ :error, _ } -> opts
156+
157+
unless Keyword.get(opts, :width) do
158+
opts = case :io.columns(device) do
159+
{ :ok, width } -> Keyword.put(opts, :width, width)
160+
{ :error, _ } -> opts
161+
end
159162
end
163+
160164
puts device, Kernel.inspect(item, opts)
161165
item
162166
end

0 commit comments

Comments
 (0)