On Fri, Oct 9, 2015 at 7:25 PM, Evan Hanson <[email protected]> wrote:

> Hi Matt,
>
> My guess is that because you don't close the output port before waiting
> for results, dot(1) sits there waiting for more input and your procedure
> appears to hang.
>

Ah, yes, dot is not processing the input until it is read in its entirety.
Thanks Evan. The following works fine:

(define (tests:run-dot indat outtype) ;; outtype is plain, fig, dot, etc.
http://www.graphviz.org/content/output-formats
  (let-values (((inp oup pid)(process "dot" (list "-T" outtype))))
    (with-output-to-port oup
      (lambda ()
    (map print indat)))
    (close-output-port oup)
    (let ((res (with-input-from-port inp
         (lambda ()
           (read-lines)))))
      (close-input-port inp)
    res)))



> I'd try closing `oup` once you've written your graph to the process, for
> example by making the thunk you use for the "dot writer" thread look like:
>
>     (lambda ()
>       (with-output-to-port oup
>        (lambda ()
>          (map print indat)
>          (close-output-port oup))))
>
> Cheers,
>
> Evan
>
> _______________________________________________
> Chicken-users mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to