Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Apr 2005 13:38:31 -0500 (CDT)
From:      Eduardo Viruena Silva <mrspock@esfm.ipn.mx>
To:        Richard Caley <rjc@caley.org.uk>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: shell question
Message-ID:  <20050406100221.M16224@Gina.esfm.ipn.mx>
In-Reply-To: <87ekdo2vnc.fsf@pele.r.caley.org.uk>
References:  <63501.201.135.130.41.1112718721.squirrel@201.135.130.41> <87ekdo2vnc.fsf@pele.r.caley.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 6 Apr 2005, Richard Caley wrote:

> In article <63501.201.135.130.41.1112718721.squirrel@201.135.130.41>, mrspock  (m) writes:
>
> m> The problem is that I don't want to use the temporary
> m> file that I used above (stdout, stderr, out), I just
> m> want a "filter"
>
> If you want to rearange the output so that all the errors are after
> all the non errors, then you are going to need storage of some sort. I
> think that is logically unavoidable.
>
> There may be some kind of shuffle you can do with named pipes or
> something, but those kind of things have limited storage. Any time
> your command produces more error output than that space can hold, it
> will be stopped. Since you are not reading that stream until the main
> output is finished you'd then have a deadlock.
>
> --
> Mail me as MYFIRSTNAME@MYLASTNAME.org.uk        _O_
>                                                  |<

Thank you, Richard.

Efectively, I found that is easier to create a temporary file with
one of the output files, in this case "stderr".   Stderr is used,
in this case to create a listing of the data that the program is
using and, occasionally, it issues an error message, in this case
the program stops.

I finally programmed this process in this way:

   program 2> tempfile | (cat && a2sp tempfile) | ps2pdf

As I already stated, my program is creating a PostScript output
in its stdout and a "listing" in the stderr file.  a2ps is
converting this listing to PostScript and both of them, finally,
are converted to a PDF document with GhostScripts [in the ports].

Finally, the name "pipes" is very precise to describe what is
happening with the "streams"; obviously, if I want to process one
of the streams after the other one, I need to contain the "water"
of the second temporally.

Thanks for your time and your help.

    Eduardo.


PS.
Perhaps you are interested in visiting my page:

	http://michelle.esfm.ipn.mx/~mrspock/superspiro

Cut & Paste one of the examples and execute the program at the
end of the page.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050406100221.M16224>