Changeset 12825


Ignore:
Timestamp:
Sep 12, 2009, 7:10:55 PM (10 years ago)
Author:
gb
Message:

Do most of the work of EXEC-WITH-IO-REDIRECTION in CREATE-WINDOWS-PROCESS
on Windows; the former requires an EXTERNAL-PROCESS object and the latter
does not.

Note that the call to CreateProcessW uses some unusual options; this
may have been based on the code in Gnu Emacs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/linux-files.lisp

    r12625 r12825  
    16631663    (reduce (lambda (left right) (concatenate 'string left " " right)) strings))
    16641664
    1665   (defun exec-with-io-redirection (new-in new-out new-err args proc &optional env)
     1665  (defun create-windows-process (new-in new-out new-err cmdstring env)
    16661666    (declare (ignore env))              ; until we can do better.
    1667     (with-filename-cstrs ((command (join-strings args)))
     1667    (with-filename-cstrs ((command cmdstring))
    16681668      (rletz ((proc-info #>PROCESS_INFORMATION)
    16691669              (si #>STARTUPINFO))
     
    16941694                                     si
    16951695                                     proc-info))
    1696           (progn
    1697             (setf (external-process-%status proc) :error
    1698                   (external-process-%exit-code proc) (#_GetLastError))
    1699             (signal-semaphore (external-process-signal proc))
    1700             (signal-semaphore (external-process-completed proc))
    1701             nil)
     1696          (values nil (#_GetLastError))
    17021697          (progn
    17031698            (#_CloseHandle (pref proc-info #>PROCESS_INFORMATION.hThread))
    1704             (pref proc-info #>PROCESS_INFORMATION.hProcess))))))
     1699            (values t (pref proc-info #>PROCESS_INFORMATION.hProcess)))))))
     1700
     1701  (defun exec-with-io-redirection (new-in new-out new-err args proc &optional env)
     1702    (multiple-value-bind (win handle-to-process-or-error)
     1703        (create-windows-process new-in new-out new-err (join-strings args) env)
     1704      (if win
     1705        handle-to-process-or-error
     1706        (progn
     1707          (setf (external-process-%status proc) :error
     1708                (external-process-%exit-code proc) handle-to-process-or-error)
     1709          (signal-semaphore (external-process-signal proc))
     1710          (signal-semaphore (external-process-completed proc))
     1711          nil))))
    17051712
    17061713  (defun fd-uninheritable (fd &key direction)
     
    18021809
    18031810
    1804 )
     1811  )
    18051812                                        ;#+windows-target (progn
    18061813
Note: See TracChangeset for help on using the changeset viewer.