99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
-
+
+
+
+
+
+
+
+
+
+
|
(loop (let ((l (read-line fh)))
(if (eof-object? l) l (proc l)))
(append result (list curr)))
result))))
;; here is an example line where the shell is sh or bash
;; "find / -print 2&>1 > findall.log"
(define (run-n-wait cmdline #!key (params #f))
(define (run-n-wait cmdline #!key (params #f)(print-cmd #f))
(if print-cmd
(debug:print 0
(if (string? print-cmd)
print-cmd
"")
cmdline
(if params
(string-intersperse params " ")
"")))
(let ((pid (if params
(process-run cmdline params)
(process-run cmdline))))
(let loop ((i 0))
(let-values (((pid-val exit-status exit-code) (process-wait pid #t)))
(if (eq? pid-val 0)
(begin
|