Handle run-program with :directory nil.
authorStas Boukarev <stassats@gmail.com>
Tue, 31 Dec 2013 13:33:53 +0000 (17:33 +0400)
committerStas Boukarev <stassats@gmail.com>
Tue, 31 Dec 2013 13:33:53 +0000 (17:33 +0400)
Handle :directory nil as advertised, not changing the current directory.

Fixes lp#1265077.

NEWS
src/code/run-program.lisp
tests/run-program.impure.lisp

diff --git a/NEWS b/NEWS
index 5977d64..083bbc4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ changes relative to sbcl-1.1.14:
     with bad constants. (reported by Douglas Katzman)
   * bug fix: CLISP can be used again as a cross-compilation host.
     (Thanks to Vasily Postnicov, lp#1261451)
+  * bug fix: run-program crashed with :directory nil. (lp#1265077)
 
 changes in sbcl-1.1.14 relative to sbcl-1.1.13:
   * optimization: complicated TYPEP tests are less opaque to the type
index eb9aa47..0ddd193 100644 (file)
@@ -690,7 +690,7 @@ status slot."
                     (if-error-exists :error)
                     status-hook
                     (external-format :default)
-                    (directory nil directory-p))
+                    directory)
   #+sb-doc
   #.(concatenate
      'string
@@ -790,7 +790,7 @@ Users Manual for details about the PROCESS structure.
          proc
          (progname (native-namestring program))
          (args (prepare-args (cons progname args)))
-         (directory (and directory-p (native-namestring directory)))
+         (directory (and directory (native-namestring directory)))
          ;; Gag.
          (cookie (list 0)))
     (unwind-protect
index 32d7606..9ad1a9a 100644 (file)
     (assert
      (equal directory
             (string-right-trim '(#\Return) (read-line out))))))
+
+(with-test (:name (:run-program :directory-nil))
+  (sb-ext:run-program #-win32 "/bin/sh"
+                      #-win32 '("-c" "pwd")
+                      #+win32 "cmd.exe"
+                      #+win32 '("/c" "cd")
+                      :directory nil
+                      :search t))