[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 1d4b327b39 1/3: Pass process-environment and exe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 1d4b327b39 1/3: Pass process-environment and exec-path through with-temp-buffer |
Date: |
Thu, 23 Jun 2022 17:58:46 -0400 (EDT) |
branch: elpa/rust-mode
commit 1d4b327b39b395dc95921f4aec975b3cebcbf563
Author: Ethan Glasser-Camp <ethan@betacantrips.com>
Commit: Ethan Glasser-Camp <ethan@betacantrips.com>
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.
---
rust-cargo.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/rust-cargo.el b/rust-cargo.el
index 58f0151f19..69ed5586d3 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)))