emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sweeprolog 7587649505 3/6: FIXED: disregard stderr when in


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 7587649505 3/6: FIXED: disregard stderr when invoking write_sweep_module_location
Date: Sat, 15 Oct 2022 07:59:14 -0400 (EDT)

branch: elpa/sweeprolog
commit 7587649505febea7df232d8d70f11db8b438ff23
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    FIXED: disregard stderr when invoking write_sweep_module_location
---
 sweep.pl      |  5 +++++
 sweeprolog.el | 68 +++++++++++++++--------------------------------------------
 2 files changed, 22 insertions(+), 51 deletions(-)

diff --git a/sweep.pl b/sweep.pl
index c697323efb..3a9667b990 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -782,6 +782,11 @@ write_sweep_module_location :-
     absolute_file_name(foreign('sweep-module'),
                        Path,
                        [file_type(executable), access(read)]),
+    (   current_prolog_flag(executable_format, elf)
+    ->  current_prolog_flag(libswipl, Libpath),
+        writeln(Libpath)
+    ;   true
+    ),
     writeln(Path).
 
 sweep_top_level_server(_, Port) :-
diff --git a/sweeprolog.el b/sweeprolog.el
index 2d023de0da..190498143c 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -217,57 +217,23 @@ clause."
 (defun sweeprolog--ensure-module ()
   "Locate and load `sweep-module', unless already loaded."
   (unless (featurep 'sweep-module)
-    (when-let ((exec-format (car
-                             (save-match-data
-                               (split-string
-                                (shell-command-to-string
-                                 (concat
-                                  (shell-quote-argument
-                                   (or sweeprolog-swipl-path (executable-find 
"swipl")))
-                                  " -q"
-                                  " -g 'current_prolog_flag(executable_format, 
X), writeln(X)'"
-                                  " -t halt"))
-                                "\n"
-                                t)))))
-      (when (string= exec-format "elf")
-        (let ((libswipl-path (or sweeprolog-libswipl-path
-                                 (car
-                                  (save-match-data
-                                    (split-string
-                                     (shell-command-to-string
-                                      (concat
-                                       (shell-quote-argument
-                                        (or sweeprolog-swipl-path 
(executable-find "swipl")))
-                                       " -q"
-                                       " -g 'current_prolog_flag(libswipl, X), 
writeln(X)'"
-                                       " -t halt"))
-                                     "\n"))))))
-          (condition-case _
-              (load libswipl-path)
-            (file-error (user-error
-                         (concat "Failed to load `libswipl'. "
-                                 "Make sure SWI-Prolog is installed "
-                                 "and up to date")))))))
-    (let ((sweep-module-path (car
-                              (save-match-data
-                                (split-string
-                                 (shell-command-to-string
-                                  (concat
-                                   (shell-quote-argument
-                                    (or sweeprolog-swipl-path (executable-find 
"swipl")))
-                                   " -g write_sweep_module_location"
-                                   " -t halt "
-                                   (shell-quote-argument
-                                    (expand-file-name
-                                     "sweep.pl"
-                                     (file-name-directory load-file-name)))))
-                                 "\n")))))
-      (condition-case _
-          (load sweep-module-path)
-        (file-error (user-error
-                     (concat "Failed to locate `sweep-module'. "
-                             "Make sure SWI-Prolog is installed "
-                             "and up to date")))))))
+    (if-let ((paths (save-match-data
+                      (split-string
+                       (with-output-to-string
+                         (with-current-buffer standard-output
+                           (call-process
+                            (or sweeprolog-swipl-path "swipl")
+                            nil '(t nil) nil
+                            "-q" "-g" "write_sweep_module_location"
+                            "-t" "halt"
+                            (expand-file-name
+                             "sweep.pl"
+                             (file-name-directory load-file-name)))))
+                       "\n" t))))
+        (mapc #'load paths)
+      (error (concat "Failed to locate `sweep-module'. "
+                     "Make sure SWI-Prolog is installed "
+                     "and up to date")))))
 
 (defface sweeprolog-debug-prefix-face
   '((default :inherit shadow))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]