[GRASS5] Re: stdout and stderr
Stefan Paulick
stefan.paulick at urbeli.com
Mon Oct 18 13:58:34 EDT 2004
I would appreciate to have some kind of dynamic configureable dispatcher,
redirecting outputs to different targets.
Mit freundlichen Grüßen / With kindest regards
Stefan Paulick
stefan.paulick at urbeli.com
http://www.urbeli.com
/*----------------------*/
Paul Kelly schrieb:
> Hello developers
> I was just wondering about the appropriateness of writing different types
> of module output to stderr or stdout, as I notice there has been some
> activity in 5.7 in this area recently. I am wondering if perhaps I have
> been wrong about how this should be used before:
>
> When writing new code and fixing bugs I have tended to ensure that only
> output which is the actual result of a GIS processing operation that needs
> to be displayed to the user (rather than written to a file in the GRASS
> database) should be written to stdout. All other errors, warnings,
> informative progress messages and copyright notices etc. are written to
> stderr.
>
> I'll use the example of re-directing output to a file to show why this
> makes logical sense to me.
> g.proj -wf proj4=+init=epsg:29900 > irishgrid.prj
> The point of this command is to convert the projection description
> described by '+init=epsg:29900' in PROJ.4 format into WKT format and store
> it in a .prj file. The WKT output is printed to stdout and stdout
> re-directed to a file, which accomplishes this nicely. But on running the
> above command, it is determined that +init=epsg:29900 does not contain
> enough information on datum parameters, so the user is prompted for more
> information. These prompts are written to stderr, so the user can still
> see them even though stdout is re-directed. The user can interactively
> choose the datum paramters and then the final version of the WKT output is
> written to the file. If the prompts also went to stdout then the user
> wouldn't see them and the program would just hang waiting for input from
> the user.
>
> I suppose that for modules that only write output to another file in the
> GIS database, having information messages printed to stdout wouldn't
> result in mixing up, but still I was under the (possibly mistaken)
> impression that writing to stderr ensured the messages would always appear
> where the user could see them and act on them, regardless of where stdout
> was appearing (e.g. in a future GUI perhaps the stdout would be placed in
> a pretty 'results' window to be stored while stderr could be kept out of
> the way).
>
> Any thoughts?
>
> Paul
>
> _______________________________________________
> grass5 mailing list
> grass5 at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass5
More information about the grass-dev
mailing list