Browse Source

Merge pull request #2212 from ferd/handle-port-unicode

Proper Unicode handling in port process output
pull/2214/head
Fred Hebert 5 years ago
committed by GitHub
parent
commit
a7e0fef349
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/rebar_utils.erl

+ 3
- 3
src/rebar_utils.erl View File

@ -189,7 +189,7 @@ sh(Command0, Options0) ->
Command = lists:flatten(patch_on_windows(Command0, proplists:get_value(env, Options0, []))),
PortSettings = proplists:get_all_values(port_settings, Options) ++
[exit_status, {line, 16384}, use_stdio, stderr_to_stdout, hide, eof],
[exit_status, {line, 16384}, use_stdio, stderr_to_stdout, hide, eof, binary],
?DEBUG("Port Cmd: ~ts\nPort Opts: ~p\n", [Command, PortSettings]),
Port = open_port({spawn, Command}, PortSettings),
@ -676,9 +676,9 @@ debug_and_abort(Command, {Rc, Output}) ->
sh_loop(Port, Fun, Acc) ->
receive
{Port, {data, {eol, Line}}} ->
sh_loop(Port, Fun, Fun(Line ++ "\n", Acc));
sh_loop(Port, Fun, Fun(unicode:characters_to_list(Line) ++ "\n", Acc));
{Port, {data, {noeol, Line}}} ->
sh_loop(Port, Fun, Fun(Line, Acc));
sh_loop(Port, Fun, Fun(unicode:characters_to_list(Line), Acc));
{Port, eof} ->
Data = lists:flatten(lists:reverse(Acc)),
receive

Loading…
Cancel
Save