Peter Bex  committed ed767d1

Support unquote-splicing through a variant of exec-path (reported by Moritz)

  • Participants
  • Parent commits 7c41a85
  • Branches default

Comments (0)

Files changed (2)

File scsh-process.scm

 (module scsh-process
   (;; procedures
-   exec-path fork %fork fork/pipe %fork/pipe fork/pipe+ %fork/pipe+
+   exec-path exec-path* fork %fork fork/pipe %fork/pipe fork/pipe+ %fork/pipe+
    run/collecting* run/string* run/strings* run/port* run/file* run/sexp* run/sexps*
    ;; macros
 ;; execve can be used in a sensible way?  Scsh has its own PATH, so we could
 ;; use something similar to that, but it's more work.
 (define (exec-path prog . args)
+  (exec-path* prog args))
+;; Internal variant, collecting args
+(define (exec-path* prog args)
   (process-execute (maybe->string prog) (map maybe->string args)))
 (define (fork/pipe #!optional thunk continue-threads?)
     ((_ (?prog ?arg0 ...) ?redir0 ...)
        (setup-redirection ?redir0) ...
-       (exec-path `?prog `?arg0 ...)))))
+       (exec-path* `?prog `(?arg0 ...))))))

File tests/run.scm

           "hi, there\n"
           (run/string (echo "hi, there")))
+    (test "Unquote-splicing run/string"
+          "hi, there\n"
+          (run/string (echo ,@(list "hi," "there"))))
     (test "Simple run/sexp"
           '("hi, there")
           (run/sexp (echo "(\"hi, there\") trailing stuff is ignored")))