Menu

#2126 'show' and 'print' commands output to stdout instead of stderr

None
closed-rejected
nobody
2019-02-11
2019-02-07
Anonymous
No

The 'show' and 'print' commands print their outputs to standard error by default. In case of 'print' command this behavior can be changed by 'set print "-"'; however, I did not find such option in case of 'show'.

This is a problem when gnuplot output is parsed by an external program which expects for a particular data, but actually it might be mixed up with warning messages.

I think the normal output of the 'show' command and any other command invoked by the user should be written to the standard output and not to the standard error, as these outputs contain data which intentionally requested by the user and not related to any exception or error.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2019-02-07

    Writing non-graphics content to stdout would break use of gnuplot as a filter. For example:

    GNUTERM=postscript myprogram | gnuplot > result.ps
    GNUTERM=svg myprogram | gnuplot > result.svg
    
     
    • Gyula Zilahi

      Gyula Zilahi - 2019-02-11

      Maybe I miss some usage cases, but to me it doesn't look like a serious problem, since if 'myprogram' generates the input for gnuplot, then I should be able to know whether to expect for a graphics as output or something else.

      Undoubtedly, the best solution would be if the user can set which channel to use like in the case of 'print' command. Would it be possible then to add an option to set the output channel not only for the print command, but for all other commands that write someting to the terminal? The default settings could remain the same, so it would not break any earlier script.

       
  • Ethan Merritt

    Ethan Merritt - 2019-02-10
    • labels: stderr, stdout, show, print, 'standard error', 'standard output' --> stderr, stdout, show, print, 'standard error', 'standard output'
    • status: open --> closed-rejected
    • Group: -->
    • Priority: -->
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.