summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2012-10-06 19:04:41 +0200
committerPeter Bex <peter@more-magic.net>2012-10-06 19:04:41 +0200
commit2c55a49100192f590fbd4b54312e55f79e27c667 (patch)
tree1b69d55c43d846eaca1663629c719ffac2941871
parent93c713f8c6b0f2c0032e7a80175646607eb6d762 (diff)
downloadscsh-process-2c55a49100192f590fbd4b54312e55f79e27c667.tar.gz
Revert back to standard-extension and include a type declaration override for scsh-process to fix bogus optimization of 'signal-handler' due to invalid scrutiny type
-rw-r--r--scsh-process.scm39
-rw-r--r--scsh-process.setup10
2 files changed, 24 insertions, 25 deletions
diff --git a/scsh-process.scm b/scsh-process.scm
index 46fba8d..c6e4337 100644
--- a/scsh-process.scm
+++ b/scsh-process.scm
@@ -111,22 +111,29 @@
(set-signal-handler!
signal/chld
- (let ((old-handler (signal-handler signal/chld)))
- (lambda (signal)
- (for-each (lambda (pid)
- (handle-exceptions exn
- ;; User might have waited manually
- (begin (remove-scsh-pending-process! pid) (void))
- (receive (pid ok? status)
- (posix-process-wait pid #t)
- (unless (zero? pid)
- (let ((p (hash-table-ref *scsh-pending-processes* pid)))
- (scsh-process-exit-status-set! p status)
- (scsh-process-ok?-set! p ok?)
- ;; The GC can clean it up
- (remove-scsh-pending-process! pid))))))
- (hash-table-keys *scsh-pending-processes*))
- (when old-handler (old-handler signal))))))
+ ;; This workaround fixes the "signal-hander" type in the types.db of 4.8.0
+ (let-syntax ((workaround
+ (cond-expand
+ (chicken-4.8
+ (syntax-rules ()
+ ((_ val) (the (or boolean (procedure (fixnum) . *)) val))))
+ (else (syntax-rules () ((_ val) val))))))
+ (let ((old-handler (workaround (signal-handler signal/chld))))
+ (lambda (signal)
+ (for-each (lambda (pid)
+ (handle-exceptions exn
+ ;; User might have waited manually
+ (begin (remove-scsh-pending-process! pid) (void))
+ (receive (pid ok? status)
+ (posix-process-wait pid #t)
+ (unless (zero? pid)
+ (let ((p (hash-table-ref *scsh-pending-processes* pid)))
+ (scsh-process-exit-status-set! p status)
+ (scsh-process-ok?-set! p ok?)
+ ;; The GC can clean it up
+ (remove-scsh-pending-process! pid))))))
+ (hash-table-keys *scsh-pending-processes*))
+ (when old-handler (old-handler signal)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/scsh-process.setup b/scsh-process.setup
index 7d54201..0c575c4 100644
--- a/scsh-process.setup
+++ b/scsh-process.setup
@@ -1,11 +1,3 @@
;; -*- Scheme -*-
-;; Can't use standard-extension for now; 4.8.0's standard-extension uses -O3
-;; which implies -specialize. This generates code that causes a segfault.
-(compile -s -O2 -d1 scsh-process.scm -j scsh-process)
-(compile -s -O2 -d0 scsh-process.import.scm)
-
-(install-extension
- 'scsh-process
- '("scsh-process.so" "scsh-process.import.so")
- '((version "0.2.1")))
+(standard-extension 'scsh-process "0.2.1")