diff options
author | Marcus Arendt <[email protected]> | 2014-12-29 10:13:57 +0100 |
---|---|---|
committer | Marcus Arendt <[email protected]> | 2014-12-29 10:13:57 +0100 |
commit | 4f7edc376ee61238699f68c8721ab23ee56eafee (patch) | |
tree | 1f403607afa54044cd2a64c6e545ee564e765b8c /lib/ssh | |
parent | bbf2555c6b8112407674c766f7884940669cf069 (diff) | |
parent | f445c0008c389ff06741e5d5a18d6c75861598cf (diff) | |
download | otp-4f7edc376ee61238699f68c8721ab23ee56eafee.tar.gz otp-4f7edc376ee61238699f68c8721ab23ee56eafee.tar.bz2 otp-4f7edc376ee61238699f68c8721ab23ee56eafee.zip |
Merge branch 'lemenkov/use_os_getenv_2'
* lemenkov/use_os_getenv_2:
fix missing include
Start using os:getenv/2 fun
Introduce os:getenv/2
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 | 13 |
2 files changed, 4 insertions, 19 deletions
diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl index c66f810948..e97bf9ceeb 100644 --- a/lib/ssh/src/ssh_connection.erl +++ b/lib/ssh/src/ssh_connection.erl @@ -200,7 +200,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), @@ -1299,11 +1299,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 e3871b3feb..c9441a46b0 100644 --- a/lib/ssh/test/ssh_connection_SUITE.erl +++ b/lib/ssh/test/ssh_connection_SUITE.erl @@ -21,6 +21,7 @@ -module(ssh_connection_SUITE). -include_lib("common_test/include/ct.hrl"). +-include_lib("ssh/src/ssh_connect.hrl"). -compile(export_all). @@ -269,7 +270,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 +283,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). %%-------------------------------------------------------------------- @@ -647,11 +648,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. |