This commit is contained in:
Yota Toyama 2023-10-13 17:19:36 +11:00
parent 70e5aa14a3
commit 77dc8c3524

View file

@ -1,8 +1,8 @@
(define-library (scheme process-context) (define-library (scheme process-context)
(import (chibi) (srfi 98)) (import (chibi) (only (scheme base) call/cc) (srfi 98))
(cond-expand (windows (import (rename (only (chibi win32 process-win32) exit) (exit emergency-exit)))) (cond-expand (windows (import (rename (chibi win32 process-win32) (exit emergency-exit))))
(else (import (rename (only (chibi process) exit) (exit emergency-exit))))) (else (import (prefix (chibi process) process-))))
(export get-environment-variable get-environment-variables (export get-environment-variable get-environment-variables
command-line exit emergency-exit) command-line exit emergency-exit)
@ -10,9 +10,11 @@
(define unwind #f) (define unwind #f)
((call/cc ((call/cc
(lambda (continuation) (lambda (cont)
(set! unwind continuation) (set! unwind cont)
(lambda () #f)))) (lambda () #f))))
(define emergency-exit process-exit)
(define (exit . rest) (define (exit . rest)
(unwind (lambda () (apply emergency-exit rest)))))) (unwind (lambda () (apply emergency-exit rest))))))