aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-02-06 16:36:32 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-02-06 16:36:32 +0100
commit10de566e138bc167256fe1c4cc25f934887738d7 (patch)
treeeeef9abab70d6bacee14b66c226823e0db89585b /lib/test_server
parentbca4b9783e9f2d6845b970f23f1b2f9a0ded7121 (diff)
downloadotp-10de566e138bc167256fe1c4cc25f934887738d7.tar.gz
otp-10de566e138bc167256fe1c4cc25f934887738d7.tar.bz2
otp-10de566e138bc167256fe1c4cc25f934887738d7.zip
test_server: Let ts_make have a latin1 fallback
Simple fallback if io:put_chars/1 fails. A badarg is likely due to latin1 code points in buffer when utf-8 was expected.
Diffstat (limited to 'lib/test_server')
-rw-r--r--lib/test_server/src/ts_make.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/test_server/src/ts_make.erl b/lib/test_server/src/ts_make.erl
index 8727f7ebfe..9cb77ecb12 100644
--- a/lib/test_server/src/ts_make.erl
+++ b/lib/test_server/src/ts_make.erl
@@ -67,7 +67,17 @@ get_port_data(Port, Last0, Complete0) ->
end.
update_last([C|Rest], Line, true) ->
- io:put_chars(list_to_binary(Line)), %% Utf-8 list to utf-8 binary
+ try
+ %% Utf-8 list to utf-8 binary
+ %% (e.g. we assume utf-8 bytes from port)
+ io:put_chars(list_to_binary(Line))
+ catch
+ error:badarg ->
+ %% io:put_chars/1 badarged
+ %% this likely means we had unicode code points
+ %% in our bytes buffer (e.g warning from gcc with åäö)
+ io:put_chars(unicode:characters_to_binary(Line))
+ end,
io:nl(),
update_last([C|Rest], [], false);
update_last([$\r|Rest], Result, Complete) ->