From 35e9bd2337a3e99561ed4c0afd6473af2bc61c94 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sat, 7 Nov 2020 10:45:32 +0100 Subject: [PATCH] agenda: Handle wrong-type-arg in select. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes Backtrace: 10 (apply-smob/1 #) In ice-9/boot-9.scm: 705:2 9 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 8 (_ #(#(#))) In ice-9/boot-9.scm: 2312:4 7 (save-module-excursion _) 3832:12 6 (_) In 8sync/actors.scm: 812:6 5 (run-hive #< 7fca5d977190> _ #:cleanup _ #:handle-signals _) In ice-9/control.scm: 91:24 4 (call-with-escape-continuation _) In 8sync/agenda.scm: 569:6 3 (run-agenda #< queue: (() . #f) prompt-tag: ("prompt") read-port-map: # …) 470:7 2 (update-agenda-from-select! #< queue: (() . #f) prompt-tag: ("prompt") read-port-map: #) In ice-9/boot-9.scm: 829:9 1 (catch system-error # # …) In unknown file: 0 (select (# #) (#) # …) ERROR: In procedure select: In procedure select: Wrong type argument in position 1: # * 8sync/agenda.scm (update-agenda-from-select!): Catch everything. --- 8sync/agenda.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/8sync/agenda.scm b/8sync/agenda.scm index e91487e..7a76ebf 100644 --- a/8sync/agenda.scm +++ b/8sync/agenda.scm @@ -467,13 +467,19 @@ Also handles sleeping when all we have to do is wait on the schedule." ;; TODO: support usecond wait time too (match (get-wait-time) ((sec . usec) - (catch 'system-error + (catch #t ; expect: wrong-type-arg (open port), system-error (lambda () (select (hash-keys (agenda-read-port-map agenda)) (hash-keys (agenda-write-port-map agenda)) '() sec usec)) (lambda (key . rest-args) + (unless (and (memq key '(system-error wrong-type-arg)) + (match rest-args + (((or "select" "get-u8" "get-bytevector-n" "lookahead-u8" + "put-u8" "put-bytevector") arg ...) #t) + (_ #f))) + (apply throw key rest-args)) (match rest-args ((_ _ _ (EINTR)) '(() () ())) -- 2.31.1