Skip to content

Commit

Permalink
Fix underlines in cmd printing
Browse files Browse the repository at this point in the history
Fixes #25589
  • Loading branch information
Keno committed Aug 6, 2018
1 parent e3bc48d commit 224da24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ function show(io::IO, cmd::Cmd)
print_dir = !isempty(cmd.dir)
(print_env || print_dir) && print(io, "setenv(")
print(io, '`')
print(io, join(map(cmd.exec) do arg
replace(sprint() do io
join(io, map(cmd.exec) do arg
replace(sprint(context=io) do io
with_output_color(:underline, io) do io
print_shell_word(io, arg, shell_special)
end
end, '`' => "\\`")
end, ' '))
end, ' ')
print(io, '`')
print_env && (print(io, ","); show(io, cmd.env))
print_dir && (print(io, "; dir="); show(io, cmd.dir))
Expand Down
5 changes: 5 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1401,3 +1401,8 @@ end
@test replstr(Union{X28004,Vector}[X28004(Any[X28004(1)])]) ==
"1-element Array{Union{X28004, Array{T,1} where T},1}:\n X(Any[X(1)])"
end

# Issue 25589 - Underlines in cmd printing
replstrcolor(x) = sprint((io, x) -> show(IOContext(io, :limit => true, :color => true),
MIME("text/plain"), x), x)
@test occursin("\e[", replstrcolor(`curl abc`))

0 comments on commit 224da24

Please sign in to comment.