From 0edc85c8e137b479dec456eedc3f402d2e2f463d Mon Sep 17 00:00:00 2001 From: Stephen Broberg Date: Wed, 3 Apr 2024 14:42:27 -0400 Subject: [PATCH] Fix for Issue #48: Changed the black executable from a string to a list to allow 'python -m black' to be used instead of just 'black' for the executable name. This is because black as a standalong executable is not something that is typically supported on windows, but the python module invocation always works, and the zombie processes that were using up file handles for Issue 48 was due to the make-process function failing when it couldn't find a black executable. Changing blacken-executable to the list fixes this problem (assuming the black module is installed). --- blacken.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blacken.el b/blacken.el index 7a8141c..4a6ed67 100644 --- a/blacken.el +++ b/blacken.el @@ -48,6 +48,10 @@ "Name of the executable to run." :type 'string) +(defcustom blacken-executable-list '(blacken-executable) + "Command (with extra arguments) to invoke black" + :type '(repeat string)) + (defcustom blacken-line-length nil "Line length to enforce. @@ -92,7 +96,7 @@ output to OUTPUT-BUFFER. Saving process stderr to ERROR-BUFFER. Return black process the exit code." (with-current-buffer input-buffer (let ((process (make-process :name "blacken" - :command `(,blacken-executable ,@(blacken-call-args)) + :command `(,@blacken-executable-list ,@(blacken-call-args)) :buffer output-buffer :stderr error-buffer :connection-type 'pipe