20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
;;======================================================================
;; Process convience utils
;;======================================================================
(use regex)
(declare (unit process))
(define (process:conservative-read port)
(let loop ((res ""))
(if (not (eof-object? (peek-char port)))
(loop (conc res (read-char port)))
res)))
|
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
;;======================================================================
;; Process convience utils
;;======================================================================
(use regex)
(declare (unit process))
(declare (uses common))
(define (process:conservative-read port)
(let loop ((res ""))
(if (not (eof-object? (peek-char port)))
(loop (conc res (read-char port)))
res)))
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
(if proc (proc pid))
(loop (read-line) (cons pid res))))))))
(define (process:alive? pid)
(handle-exceptions
exn
;; possibly pid is a process not a child, look in /proc to see if it is running still
(common:file-exists? (conc "/proc/" pid))
(let-values (((rpid exit-type exit-signal)(process-wait pid #t)))
(and (number? rpid)
(equal? rpid pid)))))
(define (process:alive-on-host? host pid)
(let ((cmd (conc "ssh " host " ps -o pid= -p " pid)))
(handle-exceptions
|
|
|
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
(if proc (proc pid))
(loop (read-line) (cons pid res))))))))
(define (process:alive? pid)
(handle-exceptions
exn
;; possibly pid is a process not a child, look in /proc to see if it is running still
(file-exists? (conc "/proc/" pid))
(let-values (((rpid exit-type exit-signal)(process-wait pid #t)))
(and (number? rpid)
(equal? rpid pid)))))
(define (process:alive-on-host? host pid)
(let ((cmd (conc "ssh " host " ps -o pid= -p " pid)))
(handle-exceptions
|