File 5105-ssh-Extend-ssh_connection_handler-setenv.patch of Package erlang
From ce89a71ad434ab41e851b4765feb98754dcb13a9 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Fri, 4 Sep 2020 17:20:53 +0200
Subject: [PATCH 05/11] ssh: Extend ssh_connection_handler:setenv
---
lib/ssh/src/ssh_connection.erl | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl
index 06dbba0dd9..7a3f334bbd 100644
--- a/lib/ssh/src/ssh_connection.erl
+++ b/lib/ssh/src/ssh_connection.erl
@@ -322,7 +322,7 @@ adjust_window(ConnectionHandler, Channel, Bytes) ->
ssh_connection_handler:adjust_window(ConnectionHandler, Channel, Bytes).
%%--------------------------------------------------------------------
--spec setenv(ConnectionRef, ChannelId, Var, Value, Timeout) -> result() when
+-spec setenv(ConnectionRef, ChannelId, Var, Value, Timeout) -> success when
ConnectionRef :: ssh:connection_ref(),
ChannelId :: ssh:channel_id(),
Var :: string(),
@@ -332,12 +332,18 @@ adjust_window(ConnectionHandler, Channel, Bytes) ->
%%
%% Description: Environment variables may be passed to the shell/command to be
%% started later.
-%%--------------------------------------------------------------------
setenv(ConnectionHandler, ChannelId, Var, Value, TimeOut) ->
- ssh_connection_handler:request(ConnectionHandler, ChannelId,
- "env", true, [?string(Var), ?string(Value)], TimeOut).
-
-
+ setenv(ConnectionHandler, ChannelId, true, Var, Value, TimeOut).
+
+setenv(ConnectionHandler, ChannelId, WantReply, Var, Value, TimeOut) ->
+ case ssh_connection_handler:request(ConnectionHandler, ChannelId,
+ "env", WantReply,
+ [?string(Var), ?string(Value)], TimeOut) of
+ ok when WantReply == false ->
+ success;
+ Reply ->
+ Reply
+ end.
%%--------------------------------------------------------------------
-spec close(ConnectionRef, ChannelId) -> ok when
ConnectionRef :: ssh:connection_ref(),
--
2.26.2