From 9a5b4e9b2a2a622e67fb55ab4262eb858dd46e54 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 5 Nov 2014 11:58:35 +0100 Subject: [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}]). --- lib/common_test/src/ct_telnet_client.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/common_test/src/ct_telnet_client.erl') 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) -> -- cgit v1.2.3