File 5106-ssh-Implement-ssh_connection-set_environment_vars-3.patch of Package erlang

From 02e41ec2b72a606328907edc69abddcd0bfd033b Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Wed, 16 Sep 2020 15:03:43 +0200
Subject: [PATCH 06/11] ssh: Implement ssh_connection:set_environment_vars/3

This reverts commit 9091f553c44e69ec24f8450ea4a0f6c3fc7d7ce4.
---
 lib/ssh/src/ssh_connection.erl | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl
index 7a3f334bbd..c069ab237e 100644
--- a/lib/ssh/src/ssh_connection.erl
+++ b/lib/ssh/src/ssh_connection.erl
@@ -63,6 +63,8 @@
 	 request_failure_msg/0, 
 	 request_success_msg/1,
 
+         send_environment_vars/3,
+
 	 encode_ip/1
         ]).
 
@@ -1539,3 +1541,15 @@ request_reply_or_data(#channel{local_id = ChannelId, user = ChannelPid},
 	    {[{channel_data, ChannelPid, Reply}], Connection}
     end.
 
+%%%----------------------------------------------------------------
+send_environment_vars(ConnectionHandler, Channel, VarNames) ->
+    lists:foldl(
+      fun(Var, success) ->
+              case os:getenv(Var) of
+                  false ->
+                      success;
+                  Value ->
+                      setenv(ConnectionHandler, Channel, false,
+                             Var, Value, infinity)
+              end
+      end, success, VarNames).
-- 
2.26.2

openSUSE Build Service is sponsored by