-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstatus.rkt
More file actions
38 lines (34 loc) · 1.21 KB
/
Copy pathstatus.rkt
File metadata and controls
38 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#lang racket/base
(require racket/contract/base)
(define-struct event () #:prefab)
(define-struct (stdout event) (bytes) #:prefab)
(define-struct (stderr event) (bytes) #:prefab)
(define-struct status (start end command-line output-log) #:prefab)
(define-struct (timeout status) () #:prefab)
(define-struct (exit status) (code) #:prefab)
(define (status-duration s)
(- (status-end s) (status-start s)))
(provide/contract
;; Notice the event? is basically (or/c stdout? stderr?) because
;; event is not exposed, so the only event?s that can exist are these
;; two.
[event?
(-> any/c boolean?)]
[struct (stdout event) ([bytes bytes?])]
[struct (stderr event) ([bytes bytes?])]
[struct status ([start number?]
[end number?]
[command-line (listof string?)]
[output-log (listof event?)])]
[struct (exit status)
([start number?]
[end number?]
[command-line (listof string?)]
[output-log (listof event?)]
[code exact-integer?])]
[struct (timeout status)
([start number?]
[end number?]
[command-line (listof string?)]
[output-log (listof event?)])]
[status-duration (status? . -> . number?)])