devops: Add subprocess environment variable set/unset procedures.
authorMatt Birkholz <matt@birchwood-abbey.net>
Mon, 19 Feb 2018 00:57:20 +0000 (17:57 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Mon, 19 Feb 2018 00:57:20 +0000 (17:57 -0700)
src/devops/build.scm

index 8f2ead7e35fb0b69c0ba861cc0f38360367828f7..a2a326aca256e8c4e922410795328d6ba9e49310 100644 (file)
@@ -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)