[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] gnuplot subprocess: python->chicken
From: |
Bryan Vicknair |
Subject: |
Re: [Chicken-users] gnuplot subprocess: python->chicken |
Date: |
Tue, 30 Apr 2013 12:58:19 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, Apr 30, 2013 at 08:29:37PM +0200, Peter Bex wrote:
> So you can fix this rather easily by calling (close-output-port o)
> before reading from stderr.
Wonderful, that did it. For future searches of the archive, here is the final
solution::
(use srfi-1 srfi-13 posix extras)
(define cmd "
set terminal pngcairo size 460,344 font 'Verdana,10'
set output '/tmp/graph-scm.png'
plot '-' using 1:2
2012-09-23 0
2012-09-30 24
2012-10-07 63
")
(define go
(lambda ()
(define-values (i o pid stderr) (process* "gnuplot"))
(write-line cmd o)
(write-line "exit" o)
; I have nothing more to say to you gnuplot, don't wait on me.
(close-output-port o)
(let ((err (read-string #f stderr)))
; I don't want to hear anything else you say gnuplot. We're done.
(close-input-port i)
(close-input-port stderr)
(when (> (string-length err) 0)
(error err)))))
Also glad to have found your blog!
Bryan Vicknair