branch: elpa/nix-mode
commit c1b1982ea7d9dfd772a3a2ffff3e0aa2ec0e33f1
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>
Fix nix-instantiate.el
---
nix-instantiate.el | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/nix-instantiate.el b/nix-instantiate.el
index 4326b7b6c4..ab88e1070c 100644
--- a/nix-instantiate.el
+++ b/nix-instantiate.el
@@ -16,16 +16,19 @@
(defun nix-instantiate--parsed (drv)
"Get the parsed version of the .drv file.
DRV file to load from."
- (let ((stdout (generate-new-buffer "nix show-derivation")))
+ (let ((stdout (generate-new-buffer "nix show-derivation"))
+ result)
(call-process nix-executable nil (list stdout nil) nil
"show-derivation" drv)
- (cdar (with-current-buffer stdout
- (when (eq (buffer-size) 0)
- (error
- "Error: nix show-derivation %s failed to produce any output"
- drv))
- (goto-char (point-min))
- (json-read)))))
+ (setq result
+ (cdar (with-current-buffer stdout
+ (when (eq (buffer-size) 0)
+ (error "nix show-derivation %s failed to produce any output"
+ drv))
+ (goto-char (point-min))
+ (json-read))))
+ (kill-buffer stdout)
+ result))
;;;###autoload
(defun nix-instantiate (nix-file &optional attribute)
@@ -68,7 +71,8 @@ EVENT the event that was fired."
(callback (lax-plist-get nix-instantiate--running-processes prop))
(funcall callback drv)))))
(setq nix-instantiate--running-processes
- (lax-plist-put nix-instantiate--running-processes prop nil))
+ (lax-plist-put nix-instantiate--running-processes prop nil)))
+ (unless (process-live-p proc)
(kill-buffer (process-buffer proc))
(kill-buffer err)))