guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you record output of both STDERR and STDIN to a string?


From: Bonface M. K.
Subject: Re: How do you record output of both STDERR and STDIN to a string?
Date: Thu, 10 Sep 2020 20:50:47 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hi!

Roel Janssen <roel@gnu.org> writes:

[...]
> Having spent a day on this myself, this is the best I had come up with:
>
> (define (virtuoso-isql-query query)
>   "Executes QUERY via ISQL and returns a both an ERROR-PORT and a PORT
> to read CSV output from."
>   (let* ((tmp        (getenv "TMPDIR"))
>          (error-port (mkstemp! (string-append (if tmp tmp "/tmp") "/sg-
> XXXXXX")))
>          (port       (open-input-pipe
>                       (format #f "~a ~a -U ~a -P ~a verbose=off
> csv_rfc4180=on csv_rfc4180_field_separator=, exec='~:a' 2> ~a"
>                               (isql-bin) (isql-port) (rdf-store-
> username)
>                               (rdf-store-password)
>                               (string-append "SPARQL " query)
>                               (port-filename error-port)))))
>     (setvbuf port 'block 4096)
>     (values error-port port)))
>
> I certainly hope someone can come up with a better solution!
>

Thanks. If I don't find anything, I'll give it a shot :)
> Kind regards,
> Roel Janssen
>
>
>
>
>

-- 
Bonface M. K. (https://www.bonfacemunyoki.com)
One Divine Emacs To Rule Them All
GPG key = D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]