split off util
This commit is contained in:
parent
6b3351aa8a
commit
bb68e4728c
|
@ -14,6 +14,7 @@
|
||||||
:use-module (sh pipe)
|
:use-module (sh pipe)
|
||||||
:use-module (sh peg)
|
:use-module (sh peg)
|
||||||
:use-module (sh io)
|
:use-module (sh io)
|
||||||
|
:use-module (sh util)
|
||||||
|
|
||||||
:export (main))
|
:export (main))
|
||||||
|
|
||||||
|
|
11
sh/pipe.scm
11
sh/pipe.scm
|
@ -9,8 +9,9 @@
|
||||||
:use-module (srfi srfi-26)
|
:use-module (srfi srfi-26)
|
||||||
|
|
||||||
:use-module (sh io)
|
:use-module (sh io)
|
||||||
|
:use-module (sh util)
|
||||||
|
|
||||||
:export (pipeline job-control-init jobs report-jobs fg bg disjoin conjoin))
|
:export (pipeline job-control-init jobs report-jobs fg bg))
|
||||||
|
|
||||||
(define-record-type <process>
|
(define-record-type <process>
|
||||||
(make-process pid command status)
|
(make-process pid command status)
|
||||||
|
@ -164,14 +165,6 @@
|
||||||
(set! job-table (cons job job-table))
|
(set! job-table (cons job job-table))
|
||||||
(if fg? (wait job))))
|
(if fg? (wait job))))
|
||||||
|
|
||||||
(define (disjoin . predicates)
|
|
||||||
(lambda (. arguments)
|
|
||||||
(any (cut apply <> arguments) predicates)))
|
|
||||||
|
|
||||||
(define (conjoin . predicates)
|
|
||||||
(lambda (. arguments)
|
|
||||||
(every (cut apply <> arguments) predicates)))
|
|
||||||
|
|
||||||
(define (reap-jobs)
|
(define (reap-jobs)
|
||||||
(set! job-table (filter (disjoin job-running? job-stopped?) job-table)))
|
(set! job-table (filter (disjoin job-running? job-stopped?) job-table)))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
(define-module (sh util)
|
||||||
|
:use-module (srfi srfi-1)
|
||||||
|
:use-module (srfi srfi-26)
|
||||||
|
|
||||||
|
:export (disjoin conjoin))
|
||||||
|
|
||||||
|
(define (disjoin . predicates)
|
||||||
|
(lambda (. arguments)
|
||||||
|
(any (cut apply <> arguments) predicates)))
|
||||||
|
|
||||||
|
(define (conjoin . predicates)
|
||||||
|
(lambda (. arguments)
|
||||||
|
(every (cut apply <> arguments) predicates)))
|
Loading…
Reference in New Issue