Changeset 11594


Ignore:
Timestamp:
Jan 7, 2009, 9:29:16 AM (11 years ago)
Author:
gb
Message:

Define *CONSECUTIVE-EOF-LIMIT* (2) - if a particular READ-LOOP invocation
receives more than *CONSECUTIVE-EOF-LIMIT* consecutive EOFs, do an
abrupt exit.

(The intent is to avoid scenarios where a thread in the IDE enters
a break loop when the standard input is open to /dev/null or similar.
If this happens during IDE initialization, there may not be a better
alternative to abrupt exit; filling logfiles with break loop prompts
is an extrememly bad alternative.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-1/l1-readloop-lds.lisp

    r11373 r11594  
    273273(defparameter *quit-on-eof* nil)
    274274
     275(defparameter *consecutive-eof-limit* 2 "max number of consecutive EOFs at a given break level, before we give up and abruptly exit.")
     276
    275277(defmethod stream-eof-transient-p (stream)
    276278  (let ((fd (stream-device stream :input)))
     
    293295         *** ** * +++ ++ + /// // / -
    294296         (eof-value (cons nil nil))
     297         (eof-count 0)
    295298         (*show-available-restarts* (and *show-restarts-on-break* *break-condition*)))
    296299    (declare (dynamic-extent eof-value))
     
    309312                                 :eof-value eof-value)
    310313                (if (eq form eof-value)
    311                   (if (and (not *batch-flag*)
    312                            (not *quit-on-eof*)
    313                            (stream-eof-transient-p input-stream))
    314                     (progn
    315                       (stream-clear-input input-stream)
    316                       (abort-break))
    317                     (exit-interactive-process *current-process*))
     314                  (progn
     315                    (when (> (incf eof-count) *consecutive-eof-limit*)
     316                      (#_ _exit 0))
     317                    (if (and (not *batch-flag*)
     318                             (not *quit-on-eof*)
     319                             (stream-eof-transient-p input-stream))
     320                      (progn
     321                        (stream-clear-input input-stream)
     322                        (abort-break))
     323                      (exit-interactive-process *current-process*)))
     324                  (progn
     325                    (setq eof-count 0)
    318326                    (or (check-toplevel-command form)
    319327                        (let* ((values (toplevel-eval form env)))
    320                           (if print-result (toplevel-print values))))))))
     328                          (if print-result (toplevel-print values)))))))))
    321329           (format *terminal-io* "~&Cancelled")))
    322330       (abort () :report (lambda (stream)
Note: See TracChangeset for help on using the changeset viewer.