mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-09 14:07:34 +02:00
Adding a `system' command.
This commit is contained in:
parent
9b0c057343
commit
2cd95a04d3
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
(define-module (chibi process)
|
(define-module (chibi process)
|
||||||
(export exit sleep alarm fork kill execute waitpid
|
(export exit sleep alarm fork kill execute waitpid system
|
||||||
process-command-line process-running?
|
process-command-line process-running?
|
||||||
set-signal-action! make-signal-set signal-set-contains?
|
set-signal-action! make-signal-set signal-set-contains?
|
||||||
signal-set-fill! signal-set-add! signal-set-delete!
|
signal-set-fill! signal-set-add! signal-set-delete!
|
||||||
|
@ -16,6 +16,12 @@
|
||||||
(import-immutable (scheme))
|
(import-immutable (scheme))
|
||||||
(cond-expand (threads (import (srfi 18))) (else #f))
|
(cond-expand (threads (import (srfi 18))) (else #f))
|
||||||
(include-shared "process")
|
(include-shared "process")
|
||||||
|
(body
|
||||||
|
(define (system cmd . args)
|
||||||
|
(let ((pid (fork)))
|
||||||
|
(if (zero? pid)
|
||||||
|
(execute cmd (cons cmd args))
|
||||||
|
(waitpid pid 0)))))
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(bsd #f)
|
(bsd #f)
|
||||||
(else
|
(else
|
||||||
|
|
Loading…
Add table
Reference in a new issue