io: more repairs to subprocess

Fix backwards tratment of `force?` in `subprocess-kill`, and
check for subprocess as valid supplied group.
This commit is contained in:
Matthew Flatt 2019-01-19 10:47:40 -07:00
parent b4cc2d849c
commit 24121798bd
2 changed files with 15 additions and 2 deletions

View File

@ -446,6 +446,15 @@
((list-ref l 4) 'kill)
((list-ref l 4) 'wait)
(test 'done-error (list-ref l 4) 'status)
(unless post-shutdown?
;; May need to wait for the init process to reap the
;; sub-pid process (since that's a sub-sub-process to
;; us)
(let loop ([n 5])
(unless (zero? n)
(when (running? sub-pid)
(sleep 0.05)
(loop (sub1 n))))))
(test post-shutdown? running? sub-pid)
(when post-shutdown?
(parameterize ([current-input-port (open-input-string "")])

View File

@ -71,6 +71,10 @@
(raise-arguments-error who "missing command argument after group argument"))
(define command (car command/args))
(check who path-string? command)
(when (subprocess? group/command)
(unless (subprocess-is-group? group/command)
(raise-arguments-error who "subprocess does not represent a new group"
"subprocess" group/command)))
(values group/command command (cdr command/args))]
[else
(raise-argument-error who "(or/c path-string? #f 'new subprocess?)" group/command)]))
@ -214,8 +218,8 @@
(define/who (subprocess-kill sp force?)
(check who subprocess? sp)
(atomically (if force?
(interrupt-subprocess sp)
(kill-subprocess sp))))
(kill-subprocess sp)
(interrupt-subprocess sp))))
;; ----------------------------------------