cmp: read msvc output in using the correct encoding

Fixes #581.
This commit is contained in:
Marius Gerbershagen 2020-07-04 17:53:38 +02:00
parent 892a34e66d
commit 2e94a6ac29
4 changed files with 32 additions and 17 deletions

2
.gitignore vendored
View file

@ -21,6 +21,8 @@ cov-int
msvc/help.doc msvc/help.doc
msvc/*.c
msvc/*.tmp
msvc/*.bat msvc/*.bat
msvc/*.lsp msvc/*.lsp
msvc/c/*.[ch] msvc/c/*.[ch]

View file

@ -17,7 +17,13 @@
(defun run-and-collect (command args &optional file) (defun run-and-collect (command args &optional file)
(handler-case (handler-case
(let ((lines (collect-lines (si:run-program-inner command args :default t)))) (let ((output-stream (si:run-program-inner command args :default t))
lines)
#+msvc
(si::stream-external-format-set
output-stream
(list (si::windows-codepage-encoding) :crlf))
(setf lines (collect-lines output-stream))
(cond ((null file) (cond ((null file)
lines) lines)
((probe-file file) ((probe-file file)
@ -147,12 +153,3 @@ we are currently using with ECL."
(defun update-compiler-features (&rest args) (defun update-compiler-features (&rest args)
(setf *compiler-features* (apply #'gather-system-features args))) (setf *compiler-features* (apply #'gather-system-features args)))
#+ecl-min
(update-compiler-features
:executable
#+(or windows cygwin mingw32) "build:ecl_min.exe"
#-(or windows cygwin mingw32) "build:ecl_min")
#+ecl-min
(format t ";;; System features: ~A~%" *compiler-features*)

View file

@ -55,6 +55,9 @@
#+(and ecl-min (not cygwin)) #+(and ecl-min (not cygwin))
(multiple-value-bind (output-stream return-status pid) (multiple-value-bind (output-stream return-status pid)
(si:run-program-inner program args :default nil) (si:run-program-inner program args :default nil)
#+msvc
(si::stream-external-format-set output-stream
(list (si::windows-codepage-encoding) :crlf))
(setf output (collect-lines output-stream)) (setf output (collect-lines output-stream))
(multiple-value-setq (return-status result) (multiple-value-setq (return-status result)
(si:waitpid pid t))) (si:waitpid pid t)))
@ -62,7 +65,9 @@
;; quoting of arguments ... ;; quoting of arguments ...
#+(and (not ecl-min) (not cygwin)) #+(and (not ecl-min) (not cygwin))
(multiple-value-bind (output-stream return-status process-obj) (multiple-value-bind (output-stream return-status process-obj)
(ext:run-program program args :wait nil) (ext:run-program program args :wait nil
#+msvc :external-format
#+msvc (list (si::windows-codepage-encoding) :crlf))
(setf output (collect-lines output-stream)) (setf output (collect-lines output-stream))
(multiple-value-setq (return-status result) (multiple-value-setq (return-status result)
(ext:external-process-wait process-obj t))) (ext:external-process-wait process-obj t)))

View file

@ -21,6 +21,23 @@
;;; ;;;
(load "bare.lsp" :verbose nil) (load "bare.lsp" :verbose nil)
;;;
;;; * External formats. These come at the very beginning since msvc needs
;;; them to compile correctly.
;;;
#+UNICODE
(load "ext:encodings;generate.lisp")
;;;
;;; * Find out what features are supported by the C compiler we are using
;;;
(progn
(c::update-compiler-features
:executable
#+(or windows cygwin mingw32) "build:ecl_min.exe"
#-(or windows cygwin mingw32) "build:ecl_min")
(format t "~&;;; System features: ~A~%" c::*compiler-features*))
;;; ;;;
;;; * Complain about functions which are not in the core ;;; * Complain about functions which are not in the core
;;; ;;;
@ -312,12 +329,6 @@
:prefix "EXT" :prefix "EXT"
:builtin #+:BUILTIN-RT t #-:BUILTIN-RT nil) :builtin #+:BUILTIN-RT t #-:BUILTIN-RT nil)
;;;
;;; * External formats
;;;
#+UNICODE
(load "ext:encodings;generate.lisp")
;;; ;;;
;;; * Package locks ;;; * Package locks
;;; ;;;