summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Glasser-Camp <ethan@betacantrips.com>2022-06-22 22:55:38 -0400
committerEthan Glasser-Camp <ethan@betacantrips.com>2022-06-22 23:06:17 -0400
commit1d4b327b39b395dc95921f4aec975b3cebcbf563 (patch)
tree6655860f8d6ead05632c450dbe243b05fba1abd8
parent5f654a5867ef3847a844d944ff5425ec3acdecc8 (diff)
downloadrust-mode-1d4b327b39b395dc95921f4aec975b3cebcbf563.tar.gz
Pass process-environment and exec-path through with-temp-buffer
This is the only place in rust-mode where we actually shell out, so I didn't extract this as a macro, but merely made the change in the one place it was necessary.
-rw-r--r--rust-cargo.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/rust-cargo.el b/rust-cargo.el
index 58f0151..69ed558 100644
--- a/rust-cargo.el
+++ b/rust-cargo.el
@@ -30,13 +30,17 @@
(defun rust-buffer-project ()
"Get project root if possible."
- (with-temp-buffer
- (let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
- (when (/= ret 0)
- (error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
- (goto-char 0)
- (let ((output (json-read)))
- (cdr (assoc-string "root" output))))))
+ (let ((env process-environment)
+ (path exec-path))
+ (with-temp-buffer
+ (setq-local process-environment env)
+ (setq-local exec-path path)
+ (let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
+ (when (/= ret 0)
+ (error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
+ (goto-char 0)
+ (let ((output (json-read)))
+ (cdr (assoc-string "root" output)))))))
(defun rust-update-buffer-project ()
(setq-local rust-buffer-project (rust-buffer-project)))