aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_telnet_client.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2014-11-05 11:58:35 +0100
committerSiri Hansen <[email protected]>2014-11-07 11:36:42 +0100
commit9a5b4e9b2a2a622e67fb55ab4262eb858dd46e54 (patch)
tree4132dcc1ea4d4d59b6d8512a09ad9b86091c9fcb /lib/common_test/src/ct_telnet_client.erl
parentc385f44d46638d54d325cab48c05ed62c819fa86 (diff)
downloadotp-9a5b4e9b2a2a622e67fb55ab4262eb858dd46e54.tar.gz
otp-9a5b4e9b2a2a622e67fb55ab4262eb858dd46e54.tar.bz2
otp-9a5b4e9b2a2a622e67fb55ab4262eb858dd46e54.zip
[ct] Add 'newline' option to send functions in ct_telnet
ct_telnet by default adds a newline to all command strings before sending to the telnet server. In some situations this is not desired, for example when sending telnet command sequences (prefixed with the Interprete As Command, IAC, character). In such cases, the new option can be used. Example - send an Are Your There (AYT) sequence: ct_telnet:send(Connection, [255,246], [{newline,false}]).
Diffstat (limited to 'lib/common_test/src/ct_telnet_client.erl')
-rw-r--r--lib/common_test/src/ct_telnet_client.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/common_test/src/ct_telnet_client.erl b/lib/common_test/src/ct_telnet_client.erl
index ce30dcb74b..3ae373e433 100644
--- a/lib/common_test/src/ct_telnet_client.erl
+++ b/lib/common_test/src/ct_telnet_client.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -35,7 +35,7 @@
%% -define(debug, true).
-export([open/2, open/3, open/4, open/5, close/1]).
--export([send_data/2, get_data/1]).
+-export([send_data/2, send_data/3, get_data/1]).
-define(TELNET_PORT, 23).
-define(OPEN_TIMEOUT,10000).
@@ -97,7 +97,11 @@ close(Pid) ->
end.
send_data(Pid, Data) ->
- Pid ! {send_data, Data++"\n"},
+ send_data(Pid, Data, true).
+send_data(Pid, Data, true) ->
+ send_data(Pid, Data++"\n", false);
+send_data(Pid, Data, false) ->
+ Pid ! {send_data, Data},
ok.
get_data(Pid) ->