diff --git a/scsh/sighandlers.scm b/scsh/sighandlers.scm index 7545bfc..f32a327 100644 --- a/scsh/sighandlers.scm +++ b/scsh/sighandlers.scm @@ -332,7 +332,7 @@ (define-foreign %%get-int-handlers (get_int_handlers) desc) -(define (%install-scsh-handlers) +(define (%install-scsh-handlers interactive?) (do ((int 0 (+ int 1))) ((= int number-of-interrupts)) (set-interrupt-handler @@ -342,7 +342,7 @@ ((< sig 0)) (let ((i (%signal->interrupt sig))) (if (not (or (= i -1) - (= sig signal/int) ; Leave ^c and +; (= sig signal/int) ; Leave ^c and (= sig signal/alrm))) ; alarm handlers alone. (set-interrupt-handler i @@ -352,15 +352,18 @@ 'scheduler-initial-thread)) (error "sighandler did not find scheduler-initial-thread, but" scheduler-initial-thread)) - - (set-interrupt-handler interrupt/keyboard - (lambda stuff - ((structure-ref threads-internal schedule-event) - scheduler-initial-thread - (enum - (structure-ref threads-internal event-type) - interrupt) - (enum interrupt keyboard)))))) + + ;; Note: this will prevent any other system to work, since it pushes + ;; a new command level ! + (if interactive? + (set-interrupt-handler interrupt/keyboard + (lambda stuff + ((structure-ref threads-internal schedule-event) + scheduler-initial-thread + (enum + (structure-ref threads-internal event-type) + interrupt) + (enum interrupt keyboard))))))) ;;; I am ashamed to say the 33 below is completely bogus. ;;; What we want is a value that is 1 + max interrupt value. diff --git a/scsh/startup.scm b/scsh/startup.scm index 5702f72..bf06e18 100644 --- a/scsh/startup.scm +++ b/scsh/startup.scm @@ -46,7 +46,9 @@ (really-dump-scsh-program (lambda (args) (init-low-interrupt) (install-event-handlers!) - (install-env) + (install-env) + (%install-scsh-handlers #f) + (install-autoreaping) (init-scsh-vars #f) ; Do it quietly. (start args)) filename)) diff --git a/scsh/top.scm b/scsh/top.scm index 2eaf3a2..259306a 100644 --- a/scsh/top.scm +++ b/scsh/top.scm @@ -240,7 +240,7 @@ (spawn forever-sleeping-thread) (init-low-interrupt) (install-event-handlers!) - (%install-scsh-handlers) + (%install-scsh-handlers (not term-switch)) (install-autoreaping) (install-env)