Skip to content

Commit

Permalink
Fix .env reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
plexus committed Nov 14, 2023
1 parent 28166ff commit 4275a6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Unreleased

## Added

## Fixed

## Changed
- Fix an issue with `.env` reloading messing up Java's env var representation

# 0.17.93-alpha (2023-09-06 / 84369b0)

Expand Down
4 changes: 2 additions & 2 deletions src/lambdaisland/launchpad/env.clj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(assert (and (= -1 (.indexOf str "="))
(= -1 (.indexOf str "\u0000"))))
(let [^java.lang.reflect.Constructor init
(first (.getDeclaredConstructors java.lang.ProcessEnvironment$Value))]
(first (.getDeclaredConstructors java.lang.ProcessEnvironment$Variable))]
(.setAccessible init true)
(.newInstance init (into-array Object ["XXX" (.getBytes "XXX")]))))

Expand All @@ -62,7 +62,7 @@
(run! (fn [[k v]] (setenv k v)) env))
([^String var ^String val]
;; This one is used by ProcessBuilder
(.put theEnvironment (new-value var) (new-variable val))
(.put theEnvironment (new-variable var) (new-value val))
;; This one is used by System/getenv
(.put theUnmodifiableEnvironment var val)
;; Also change the actual OS environment for the process
Expand Down

0 comments on commit 4275a6c

Please sign in to comment.