From 2e06c9a62f8fa97f1f84c573c3b4f84e605629ad Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Tue, 18 Jun 2013 21:10:32 +0200 Subject: Support unquote-splicing through a variant of exec-path (reported by Moritz) --- scsh-process.scm | 10 +++++++--- tests/run.scm | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scsh-process.scm b/scsh-process.scm index e53cbf3..08f5d77 100644 --- a/scsh-process.scm +++ b/scsh-process.scm @@ -39,7 +39,7 @@ (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 @@ -152,6 +152,10 @@ ;; 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?) @@ -383,6 +387,6 @@ ((_ (?prog ?arg0 ...) ?redir0 ...) (begin (setup-redirection ?redir0) ... - (exec-path `?prog `?arg0 ...))))) + (exec-path* `?prog `(?arg0 ...)))))) -) \ No newline at end of file +) diff --git a/tests/run.scm b/tests/run.scm index 13313e5..ff7896d 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -29,6 +29,10 @@ "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"))) @@ -146,4 +150,4 @@ (test-end) -(test-exit) \ No newline at end of file +(test-exit) -- cgit v1.2.3