diff options
author | Peter Lemenkov <[email protected]> | 2014-12-02 13:31:37 +0300 |
---|---|---|
committer | Peter Lemenkov <[email protected]> | 2014-12-15 21:05:05 +0300 |
commit | bb7fb3c31d1939ab39fb14322d11a59bc34d8f42 (patch) | |
tree | b3a37d800ac7d073723cd5cc02da09839e2b79e8 /lib/ssh | |
parent | 5cbad390e971ff92a7fb1b71757041ff9edeb81a (diff) | |
download | otp-bb7fb3c31d1939ab39fb14322d11a59bc34d8f42.tar.gz otp-bb7fb3c31d1939ab39fb14322d11a59bc34d8f42.tar.bz2 otp-bb7fb3c31d1939ab39fb14322d11a59bc34d8f42.zip |
Start using os:getenv/2 fun
See #535
Signed-off-by: Peter Lemenkov <[email protected]>
Diffstat (limited to 'lib/ssh')
-rw-r--r-- | lib/ssh/src/ssh_connection.erl | 10 | ||||
-rw-r--r-- | lib/ssh/test/ssh_connection_SUITE.erl | 12 |
2 files changed, 3 insertions, 19 deletions
diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index 01141622d6..454a2d943a 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -194,7 +194,7 @@ ptty_alloc(ConnectionHandler, Channel, Options, TimeOut) -> {Width, PixWidth} = pty_default_dimensions(width, Options), {Hight, PixHight} = pty_default_dimensions(hight, Options), pty_req(ConnectionHandler, Channel, - proplists:get_value(term, Options, default_term()), + proplists:get_value(term, Options, os:getenv("TERM", ?DEFAULT_TERMINAL)), proplists:get_value(width, Options, Width), proplists:get_value(hight, Options, Hight), proplists:get_value(pixel_widh, Options, PixWidth), @@ -1293,11 +1293,3 @@ decode_ip(Addr) when is_binary(Addr) -> {error,_} -> Addr; {ok,A} -> A end. - -default_term() -> - case os:getenv("TERM") of - false -> - ?DEFAULT_TERMINAL; - Str when is_list(Str)-> - Str - end. diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl index 85bd2c75d4..2420f60c5f 100644 --- a/lib/ssh/test/ssh_connection_SUITE.erl +++ b/lib/ssh/test/ssh_connection_SUITE.erl @@ -269,7 +269,7 @@ ptty_alloc(Config) when is_list(Config) -> {user_interaction, false}]), {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId, - [{term, default_term()}, {width, 70}, {high, 20}]), + [{term, os:getenv("TERM", ?DEFAULT_TERMINAL)}, {width, 70}, {high, 20}]), ssh:close(ConnectionRef). @@ -282,7 +282,7 @@ ptty_alloc_pixel(Config) when is_list(Config) -> {user_interaction, false}]), {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity), success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId, - [{term, default_term()}, {pixel_widh, 630}, {pixel_hight, 470}]), + [{term, os:getenv("TERM", ?DEFAULT_TERMINAL)}, {pixel_widh, 630}, {pixel_hight, 470}]), ssh:close(ConnectionRef). %%-------------------------------------------------------------------- @@ -622,11 +622,3 @@ ssh_exec(Cmd) -> spawn(fun() -> io:format(Cmd ++ "\n") end). - -default_term() -> - case os:getenv("TERM") of - false -> - "vt100"; - Str when is_list(Str)-> - Str - end. |