From 72b425c06924a3f5de4031a654b9ec7d2e646161 Mon Sep 17 00:00:00 2001 From: Clay Harrison Date: Fri, 18 Jul 2025 16:09:32 +0200 Subject: [PATCH] Add safe-shell-command and use it for getting json (broken) --- micromamba.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/micromamba.el b/micromamba.el index c8108b4..7267c31 100644 --- a/micromamba.el +++ b/micromamba.el @@ -87,6 +87,12 @@ (defvar eshell-path-env) +(defun safe-shell-command (args &optional output-buffer error-buffer) + (apply 'shell-command (mapconcat 'shell-quote-argument args " ") + output-buffer error-buffer nil)) + +;; (safe-shell-command (#'micromamba-executable "env" "list" "--json")) + (defun micromamba--call-json (&rest args) "Call micromamba and parse the return value as JSON. @@ -94,7 +100,9 @@ Pass ARGS as arguments to the program." (unless micromamba-executable (user-error "Micromamba-executable is not set!")) (with-temp-buffer - (apply #'call-process micromamba-executable nil t nil args) + (if (file-remote-p default-directory) + (safe-shell-command (cons micromamba-executable args) (current-buffer)) + (apply #'call-process micromamba-executable nil t nil args)) (goto-char (point-min)) (json-read)))