mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-04-26 03:10:35 -07:00
Avoid using system() all together because our SIGCHLD handler interferes with it on OSX 32 bits
This commit is contained in:
parent
ee7ce02155
commit
f0ace1a759
6 changed files with 40 additions and 27 deletions
|
|
@ -35,22 +35,10 @@
|
|||
(setq si::*keep-definitions* nil)
|
||||
|
||||
;;;
|
||||
;;; * Create commit version number
|
||||
;;; * Create bogus commit version number
|
||||
;;;
|
||||
|
||||
(setq si::+commit-id+ "UNKNOWN")
|
||||
(when (and (not (member :windows *features*))
|
||||
(probe-file "@top_srcdir@/../.git/"))
|
||||
(when (probe-file "COMMIT-ID")
|
||||
(delete-file "COMMIT-ID"))
|
||||
(when (and (zerop (si::system "(cd \"@top_srcdir@\" && git log --format=oneline -1) > COMMIT-ID"))
|
||||
(probe-file "COMMIT-ID"))
|
||||
(let* ((file (open "COMMIT-ID" :direction :input :element-type :default
|
||||
:external-format :default))
|
||||
(line (read-line file))
|
||||
(l (length line)))
|
||||
(setq si::+commit-id+ (subseq line 0 (min l 40)))
|
||||
(close file))))
|
||||
|
||||
;;;
|
||||
;;; * Load Common-Lisp base library
|
||||
|
|
@ -174,6 +162,23 @@
|
|||
#+:wants-dlopen
|
||||
(push (c::build-fasl name :lisp-files objects) *module-files*))))
|
||||
|
||||
;;;
|
||||
;;; * Update version number now that SI:SYSTEM is available
|
||||
;;;
|
||||
|
||||
(when (and (not (member :windows *features*))
|
||||
(probe-file "@top_srcdir@/../.git/"))
|
||||
(when (probe-file "COMMIT-ID")
|
||||
(delete-file "COMMIT-ID"))
|
||||
(when (and (zerop (si::system "(cd \"@top_srcdir@\" && git log --format=oneline -1) > COMMIT-ID"))
|
||||
(probe-file "COMMIT-ID"))
|
||||
(let* ((file (open "COMMIT-ID" :direction :input :element-type :default
|
||||
:external-format :default))
|
||||
(line (read-line file))
|
||||
(l (length line)))
|
||||
(setq si::+commit-id+ (subseq line 0 (min l 40)))
|
||||
(close file))))
|
||||
|
||||
;;;
|
||||
;;; * Go back to build directory to start compiling
|
||||
;;;
|
||||
|
|
|
|||
|
|
@ -1246,7 +1246,7 @@ cl_symbols[] = {
|
|||
{SYS_ "STRUCTUREP", SI_ORDINARY, si_structurep, 1, OBJNULL},
|
||||
{SYS_ "SVSET", SI_ORDINARY, si_svset, 3, OBJNULL},
|
||||
{SYS_ "SYMBOL-MACRO", SI_ORDINARY, NULL, -1, OBJNULL},
|
||||
{EXT_ "SYSTEM", EXT_ORDINARY, si_system, 1, OBJNULL},
|
||||
{EXT_ "SYSTEM", EXT_ORDINARY, ECL_NAME(si_system), 1, OBJNULL},
|
||||
{SYS_ "TERMINAL-INTERRUPT", SI_ORDINARY, NULL, -1, OBJNULL},
|
||||
{SYS_ "TOP-LEVEL", SI_ORDINARY, NULL, -1, OBJNULL},
|
||||
{SYS_ "UNIVERSAL-ERROR-HANDLER", SI_ORDINARY, NULL, -1, OBJNULL},
|
||||
|
|
|
|||
|
|
@ -1246,7 +1246,7 @@ cl_symbols[] = {
|
|||
{SYS_ "STRUCTUREP","si_structurep"},
|
||||
{SYS_ "SVSET","si_svset"},
|
||||
{SYS_ "SYMBOL-MACRO",NULL},
|
||||
{EXT_ "SYSTEM","si_system"},
|
||||
{EXT_ "SYSTEM","ECL_NAME(si_system)"},
|
||||
{SYS_ "TERMINAL-INTERRUPT",NULL},
|
||||
{SYS_ "TOP-LEVEL",NULL},
|
||||
{SYS_ "UNIVERSAL-ERROR-HANDLER",NULL},
|
||||
|
|
|
|||
|
|
@ -39,18 +39,6 @@
|
|||
# undef environ
|
||||
#endif
|
||||
|
||||
cl_object
|
||||
si_system(cl_object cmd_string)
|
||||
{
|
||||
cl_object cmd = si_copy_to_simple_base_string(cmd_string);
|
||||
int code = system((const char *)(cmd->base_string.self));
|
||||
/* FIXME! Are there any limits for system()? */
|
||||
/* if (cmd->base_string.fillp >= 1024)
|
||||
FEerror("Too long command line: ~S.", 1, cmd);*/
|
||||
/* FIXME! This is a non portable way of getting the exit code */
|
||||
@(return MAKE_FIXNUM(code >> 8))
|
||||
}
|
||||
|
||||
cl_object
|
||||
si_getpid(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -911,6 +911,8 @@
|
|||
nsubstitute nsubstitute-if nsubstitute-if-not find find-if find-if-not
|
||||
position position-if position-if-not remove-duplicates
|
||||
delete-duplicates mismatch search sort stable-sort merge constantly
|
||||
;; process.lsp
|
||||
ext:system
|
||||
;; pprint.lsp
|
||||
pprint-fill copy-pprint-dispatch pprint-dispatch
|
||||
pprint-linear pprint-newline pprint-tab pprint-tabular
|
||||
|
|
|
|||
|
|
@ -25,3 +25,21 @@
|
|||
(if (eq status :running)
|
||||
(ext:external-process-wait external-process nil)
|
||||
(values status (external-process-%code external-process)))))
|
||||
|
||||
;;;
|
||||
;;; Backwards compatible SI:SYSTEM call. We avoid ANSI C system()
|
||||
;;; because we are consuming the process wait status using a SIGCHLD
|
||||
;;; handler -- this breaks some C libraries out there (OS X 32 bit).
|
||||
;;;
|
||||
(defun system (cmd-string)
|
||||
(let ((shell (getenv "SHELL"))
|
||||
(option "-c"))
|
||||
#+windows
|
||||
(let ((comspec (getenv "ComSpec")))
|
||||
(when comspec
|
||||
(setf shell comspec
|
||||
option "/c")))
|
||||
(nth-value 1 (run-program shell (list option cmd-string)
|
||||
:wait t :output t :input t
|
||||
:error t))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue