From 82cd148d729c241e79c8df04b700beec1b7c55de Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Tue, 31 Dec 2013 17:33:53 +0400 Subject: [PATCH] Handle run-program with :directory nil. Handle :directory nil as advertised, not changing the current directory. Fixes lp#1265077. --- NEWS | 1 + src/code/run-program.lisp | 4 ++-- tests/run-program.impure.lisp | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 5977d64..083bbc4 100644 --- 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 diff --git a/src/code/run-program.lisp b/src/code/run-program.lisp index eb9aa47..0ddd193 100644 --- a/src/code/run-program.lisp +++ b/src/code/run-program.lisp @@ -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 diff --git a/tests/run-program.impure.lisp b/tests/run-program.impure.lisp index 32d7606..9ad1a9a 100644 --- a/tests/run-program.impure.lisp +++ b/tests/run-program.impure.lisp @@ -332,3 +332,11 @@ (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)) -- 1.7.10.4