mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-19 02:37:34 +02:00
Adding a system? variant of system which returns #t iff the command completes successfully.
Also allowing a list as the first argument to both.
This commit is contained in:
parent
db16fc693c
commit
74ed34b4a3
2 changed files with 8 additions and 3 deletions
|
@ -68,11 +68,16 @@
|
||||||
(let ((pid (fork)))
|
(let ((pid (fork)))
|
||||||
(cond
|
(cond
|
||||||
((zero? pid)
|
((zero? pid)
|
||||||
(execute cmd (cons cmd args))
|
(let ((cmd ((if (pair? cmd) append cons) cmd args)))
|
||||||
(execute-returned cmd))
|
(execute (car cmd) cmd)
|
||||||
|
(execute-returned cmd)))
|
||||||
(else
|
(else
|
||||||
(waitpid pid 0)))))
|
(waitpid pid 0)))))
|
||||||
|
|
||||||
|
(define (system? cmd . args)
|
||||||
|
(let ((res (apply system cmd args)))
|
||||||
|
(and (pair? res) (zero? (cadr res)))))
|
||||||
|
|
||||||
(define (call-with-process-io command proc)
|
(define (call-with-process-io command proc)
|
||||||
(define (set-non-blocking! fd)
|
(define (set-non-blocking! fd)
|
||||||
(cond-expand
|
(cond-expand
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
(define-library (chibi process)
|
(define-library (chibi process)
|
||||||
(export exit sleep alarm %fork fork kill execute waitpid system
|
(export exit sleep alarm %fork fork kill execute waitpid system system?
|
||||||
process-command-line process-running?
|
process-command-line process-running?
|
||||||
set-signal-action! make-signal-set
|
set-signal-action! make-signal-set
|
||||||
signal-set? signal-set-contains?
|
signal-set? signal-set-contains?
|
||||||
|
|
Loading…
Add table
Reference in a new issue