subprocesses in spiffy pasted by bryanvick on Thu May 23 00:37:13 2013

(use posix spiffy)

(define (server arg)
  (print "starting subprocess...")
  (define-values (i o pid e) (process* "non-existant" '("arg1" "arg2")))
  (close-output-port o)
  (close-input-port i)
  (close-input-port e)
  (send-status ok "done"))

(access-log (current-output-port))
(error-log (current-error-port))
(debug-log (current-output-port))
(handle-not-found server)
(root-path "./")
(start-server)

close ports pasted by evhan on Thu May 23 01:45:09 2013

;;
;; The two-argument variants of process & process* signal an error
;; when "non-existant" can't be run, so the close-*-port forms are
;; never executed and the implicit process-wait that comes with
;; process* doesn't clean up the child.
;;
;; You must make sure the ports are closed somehow,
;; e.g. (not necessarily the best way):
;;

(use posix spiffy)

(define (server arg)
  (let-values (((i o e) (values #f #f #f)))
    (dynamic-wind
     void
     (lambda ()
       (print "starting subprocess...")
       (let-values (((i* o* pid e*) (process* "non-existant")))
         (set! i i*)
         (set! o o*)
         (set! e e*)))
     (lambda ()
       (print "closing subprocess ports...")
       (close-input-port i)
       (close-input-port e)
       (close-output-port o)
       (send-status 'ok "done")))))

(access-log (current-output-port))
(error-log (current-error-port))
(debug-log (current-output-port))
(handle-not-found server)
(root-path "./")
(start-server)

wrong added by evhan on Thu May 23 08:31:07 2013

;; Above is wrong (some dummy misunderstood how process* does/doesn't signal errors)... Explanation of actual problem on chicken-users.