From: Matt Birkholz <matt@birchwood-abbey.net>
Date: Mon, 19 Feb 2018 00:57:20 +0000 (-0700)
Subject: devops: Add subprocess environment variable set/unset procedures.
X-Git-Tag: mit-scheme-pucked-devops-0.5~6
X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=bca254886bb23864f1b56ed2dc5890cc64e4c4c1;p=mit-scheme.git

devops: Add subprocess environment variable set/unset procedures.
---

diff --git a/src/devops/build.scm b/src/devops/build.scm
index 8f2ead7e3..a2a326aca 100644
--- a/src/devops/build.scm
+++ b/src/devops/build.scm
@@ -357,6 +357,18 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 	  (vector-set! new new-i (string prefix value))
 	  new))))
 
+(define (set-subprocess-environment-variable! name value)
+  (set! scheme-subprocess-environment
+	(setenv! name value scheme-subprocess-environment)))
+
+(define (delete-subprocess-environment-variable! name)
+  (set! scheme-subprocess-environment
+	(let ((prefix (string name"=")))
+	  (list->vector
+	   (filter (lambda (elt)
+		     (not (string-prefix? prefix elt)))
+		   (vector->list scheme-subprocess-environment))))))
+
 (let ((len (vector-length scheme-subprocess-environment)))
   (let loop ((i 0))
     (if (fix:< i len)