~ chicken-core (chicken-5) b4252bb33bbc57b3c00c89d2f1ce7c8cf5bf124d


commit b4252bb33bbc57b3c00c89d2f1ce7c8cf5bf124d
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Wed Jul 2 15:39:45 2025 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Wed Jul 2 15:39:45 2025 +0100

    add arg conversions back to quote args on windows

diff --git a/posix-common.scm b/posix-common.scm
index 50d892a4..d4fec5ed 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -785,9 +785,9 @@ EOF
 
 (define call-with-exec-args
   (let ((nop (lambda (x) x)))
-    (lambda (loc filename arglist envlist proc)
+    (lambda (loc filename argconv arglist envlist proc)
       (let* ((args (cons filename arglist)) ; Add argv[0]
-             (argbuf (list->c-string-buffer args (lambda (x) x) loc))
+             (argbuf (list->c-string-buffer args argconv loc))
              (envbuf #f))
 
         (handle-exceptions exn
diff --git a/posixunix.scm b/posixunix.scm
index 8ed61ea6..317f0e5c 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1126,7 +1126,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 (set! chicken.process#process-execute
   (lambda (filename #!optional (arglist '()) envlist _)
     (call-with-exec-args
-     'process-execute filename arglist envlist
+     'process-execute filename (lambda (x) x) arglist envlist
      (lambda (prg argbuf envbuf)
        (let ((r (if envbuf
                     (##core#inline "C_u_i_execve" prg argbuf envbuf)
diff --git a/posixwin.scm b/posixwin.scm
index e4ed6301..53cb9645 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -728,7 +728,8 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
              (let loop ((i 0))
                (cond
                 ((fx= i len) #f)
-                ((char-whitespace? (string-ref s i)) #t)
+                ((char-whitespace? (string-ref s i)))
+                ((char=? #\' (string-ref s i)))
                 (else (loop (fx+ i 1)))))))))
     (lambda (str)
       (if (needs-quoting? str) (string-append "\"" str "\"") str))))
@@ -746,21 +747,23 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
 
 (set! chicken.process#process-execute
   (lambda (filename #!optional (arglist '()) envlist exactf)
-    (call-with-exec-args
-       'process-execute filename arglist envlist
+    (let ((conv (if exactf (lambda (x) x) quote-arg-string)))
+     (call-with-exec-args
+       'process-execute filename conv arglist envlist
        (lambda (prg argbuf envbuf)
          (##core#inline "C_flushall")
          (let ((r (if envbuf
                       (##core#inline "C_u_i_execve" prg argbuf envbuf)
                       (##core#inline "C_u_i_execvp" prg argbuf))))
            (when (fx= r -1)
-             (posix-error #:process-error 'process-execute "cannot execute process" filename)))))))
+             (posix-error #:process-error 'process-execute "cannot execute process" filename))))))))
 
 (set! chicken.process#process-spawn
   (lambda (mode filename #!optional (arglist '()) envlist exactf)
+    (let ((conv (if exactf (lambda (x) x) quote-arg-string)))
       (##sys#check-fixnum mode 'process-spawn)
       (call-with-exec-args
-       'process-spawn filename arglist envlist
+       'process-spawn filename conv arglist envlist
        (lambda (prg argbuf envbuf)
          (##core#inline "C_flushall")
          (let ((r (if envbuf
@@ -769,7 +772,7 @@ static int set_file_mtime(C_word filename, C_word atime, C_word mtime)
            (if (fx= r -1)
                (posix-error #:process-error 'process-spawn
                             "cannot spawn process" filename)
-               (register-pid r)))))))
+               (register-pid r))))))))
 
 (define-foreign-variable _shlcmd c-string "C_shlcmd")
 
Trap