From 2fb64f6d82fb9d606df39e8f4b62cc9ee001efda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Fri, 17 Feb 2017 16:49:32 +0100 Subject: [PATCH] run-program: process passed arguments properly --- src/c/unixsys.d | 9 +++++---- src/lsp/process.lsp | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/c/unixsys.d b/src/c/unixsys.d index f54979f45..ef98fcfbb 100644 --- a/src/c/unixsys.d +++ b/src/c/unixsys.d @@ -568,9 +568,9 @@ si_run_program_internal(cl_object command, cl_object argv, cl_object env_buffer; char *env = NULL; - /* Enclose each argument, as well as the file name - in double quotes, to avoid problems when these - arguments or file names have spaces */ + /* Command is passed as is from argv. It is responsibility of + higher level interface to decide, whenever arguments should be + quoted or left as-is.*/ command = ecl_null_terminated_base_string(argv); if (!Null(environ)) { @@ -628,10 +628,11 @@ si_run_program_internal(cl_object command, cl_object argv, if (child_stdout) CloseHandle(child_stdout); if (child_stderr) CloseHandle(child_stderr); } -#elif !defined(NACL) /* mingw */ +#elif !defined(NACL) /* All POSIX but NaCL/pNaCL */ { int child_stdin, child_stdout, child_stderr; int pipe_fd[2]; + argv = ecl_nconc(argv, ecl_list1(ECL_NIL)); argv = _ecl_funcall3(@'coerce', argv, @'vector'); create_descriptor(input, @':input', &child_stdin, &parent_write); diff --git a/src/lsp/process.lsp b/src/lsp/process.lsp index 76f8229af..cfaaba3ae 100644 --- a/src/lsp/process.lsp +++ b/src/lsp/process.lsp @@ -104,8 +104,9 @@ :direction :output :if-exists if-error-exists))) - (let ((args (prepare-args (cons command argv)))) - (si:run-program-internal (si:copy-to-simple-base-string command) args + (let* ((args (prepare-args (cons command argv))) + (progname (car args))) + (si:run-program-internal progname args input output error wait environ external-format))))