unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Thomas Danckaert <post@thomasdanckaert.be>
To: guile-user@gnu.org
Subject: Re: capture stdout and stderr
Date: Sun, 27 May 2018 19:26:54 +0200 (CEST)	[thread overview]
Message-ID: <20180527.192654.1341019063623949776.post@thomasdanckaert.be> (raw)
In-Reply-To: <CAGua6m1qMCrO_iFpxPiD1pM8FopkyMo4ypCeQ6F5rCCixyPFMQ@mail.gmail.com>

From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Subject: Re: capture stdout and stderr
Date: Thu, 24 May 2018 15:25:51 +0200

> I think that your code whould work but doesn't because string ports 
> are not file ports and system commands pipes out to file ports.
>
> 'open-input-pipe' uses 'scm_open_process' that returns only a 
> read-port and a write-port, the write port is then taped the output 
> string in your run-command.
> and it works.
>
> ALso when you create a err-port with pipe, you create a file port 
> nad this will be used translated as an error port for the system 
> comand and it all works.
> However the failing program uses a string port which is not a file 
> port and it does not end up capturing the error output in the 
> system command.
>
> One would wish that guile if the error port is not a file port make 
> a file port, as done with 'pipe' and create a thread that pipes the 
> data from the file port to the non file port and your code
> would work. Also similarly behavior for read and write ports 
> towards the shell.
>
> the relevant code is in posix.c, scm_open_process

Hi! Thanks for the message.  Indeed, that makes sense.  In fact I had 
some vague intuition that some magic would be needed to channel the 
stderr output into such a string port.  I think the manual could be 
more explicit about that, though? (e.g. in the section on  default 
ports 
https://www.gnu.org/software/guile/manual/html_node/Default-Ports.html#Default-Ports 
).  Maybe I should propose a patch to the docs, stating that those 
"with-x-to-port" methods only work on file ports.

Thomas




  parent reply	other threads:[~2018-05-27 17:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  8:10 capture stdout and stderr Thomas Danckaert
2018-05-26 10:24 ` Catonano
2018-05-26 11:40   ` Thomas Danckaert
     [not found] ` <CAGua6m1qMCrO_iFpxPiD1pM8FopkyMo4ypCeQ6F5rCCixyPFMQ@mail.gmail.com>
2018-05-27 17:26   ` Thomas Danckaert [this message]
2018-05-29 17:35     ` Catonano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180527.192654.1341019063623949776.post@thomasdanckaert.be \
    --to=post@thomasdanckaert.be \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).