From 0706122f8d0c21aa2cd519ed284e939aca668827 Mon Sep 17 00:00:00 2001 From: Ashish SHUKLA Date: Mon, 21 Sep 2015 10:45:01 +0530 Subject: [PATCH] Fix `shell-command' on ABCL For passing input stream to `shell-command', ABCL implementation uses `file-to-string-as-lines' on `input', which appends an extra line-ending character to the output, so as a fix remove the extra line-ending character. --- dev/abcl.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/abcl.lisp b/dev/abcl.lisp index de8968d..5d72240 100644 --- a/dev/abcl.lisp +++ b/dev/abcl.lisp @@ -3,11 +3,13 @@ (defun %shell-command (command input) #+unix (with-input (input-stream (or input :none)) - (let (proc out-string err-string out-stream err-stream in-stream) + (let (proc out-string err-string in-string out-stream err-stream in-stream) (setf proc (system:run-program *bourne-compatible-shell* (list "-c" command) :wait nil)) (when input-stream (setf in-stream (system:process-input proc)) - (write-string (file-to-string-as-lines input-stream) :output-stream in-stream) + (setf in-string (file-to-string-as-lines input-stream)) + ;; on all UNIXen the line-ending character is of 1 byte length + (write-string in-string in-stream :end (- (length in-string) 1)) (close in-stream)) (setf out-stream (system:process-output proc)) (setf err-stream (system:process-error proc)) -- 2.11.4.GIT