summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2013-06-18 21:10:32 +0200
committerPeter Bex <peter@more-magic.net>2013-06-18 21:10:32 +0200
commit2e06c9a62f8fa97f1f84c573c3b4f84e605629ad (patch)
tree94e64bd763607b198e476e4d5a47ae02c05e7e6c
parent33317e50521f6ccf2575b63ff18098d08ad84548 (diff)
downloadscsh-process-2e06c9a62f8fa97f1f84c573c3b4f84e605629ad.tar.gz
Support unquote-splicing through a variant of exec-path (reported by Moritz)
-rw-r--r--scsh-process.scm10
-rw-r--r--tests/run.scm6
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)