This commit is contained in:
Yota Toyama 2024-05-26 13:06:58 +09:00
parent f41a61f748
commit 0673eae46d
5 changed files with 31 additions and 24 deletions

View file

@ -1,20 +1,29 @@
(define unwind #f)
((call/cc
(lambda (k)
(set! unwind k)
(lambda () #f))))
(cond-expand
(plan9
(define (exit . o)
(define (emergency-exit . o)
(%exit (if (pair? o)
(if (string? (car o))
(car o)
(if (eq? #t (car o)) "" "chibi error"))
""))))
(else
(define (exit . o)
(define (emergency-exit . o)
(%exit (if (pair? o)
(if (integer? (car o))
(inexact->exact (car o))
(if (eq? #t (car o)) 0 1))
0)))))
(define (exit . o)
(unwind (lambda () (apply emergency-exit o))))
(cond-expand
(bsd
(define (process-command-line pid)

View file

@ -1,6 +1,7 @@
(define-library (chibi process)
(export exit sleep alarm %fork fork kill execute waitpid system system?
(export exit emergency-exit sleep alarm
%fork fork kill execute waitpid system system?
process-command-line process-running?
set-signal-action! make-signal-set
signal-set? signal-set-contains?

View file

@ -1,7 +1,17 @@
(define (exit . code?)
(define unwind #f)
((call/cc
(lambda (k)
(set! unwind k)
(lambda () #f))))
(define (emergency-exit . code?)
(%exit (if (pair? code?)
(let ((c (car code?)))
(cond ((integer? c) c)
((eq? #t c) 0)
(else 1)))
0)))
(define (exit . o)
(unwind (lambda () (apply emergency-exit o))))

View file

@ -1,9 +1,9 @@
(define-library (chibi win32 process-win32)
(import (scheme base))
(export exit)
(export exit emergency-exit)
(cond-expand
(windows
(include-shared "process-win32")
(include "process-win32.scm"))
(else
(import (only (chibi process) exit)))))
(import (only (chibi process) exit emergency-exit)))))

View file

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