with-system-properties

clojure.contrib.properties

  • (with-system-properties settings & body)
setting => property-name value

Sets the system properties to the supplied values, executes the body, and
sets the properties back to their original values. Values of nil are
translated to a clearing of the property.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/properties.clj:33 top

(defmacro with-system-properties
  "setting => property-name value

  Sets the system properties to the supplied values, executes the body, and
  sets the properties back to their original values. Values of nil are
  translated to a clearing of the property."
  [settings & body]
  `(let [settings# ~settings
         current# (reduce (fn [coll# k#]
			    (assoc coll# k# (get-system-property k#)))
			  {}
			  (keys settings#))]
     (set-system-properties settings#)       
     (try
      ~@body
      (finally
       (set-system-properties current#)))))
Vars in clojure.contrib.properties/with-system-properties: defmacro apply assoc concat fn hash-map keys let list reduce seq vector
Used in 0 other vars

Comments top

No comments for with-system-properties. Log in to add a comment.