On 26 November 2012 10:48, Matthew Brush mbrush@codebrainz.ca wrote:
On 12-11-25 02:44 PM, Lex Trotman wrote:
[...]
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
What's the point about it BTW? Normally a command exit status should be the way to check, I don't see why we should make weird guess at a command not being allowed to output something on stderr?
Well, I don't know the original argument for doing it this way, but I've got two:
- the command is meant to be a filter, stdin to stdout, anything on
stderr almost certainly indicates a problem.
Filter programs sometimes use stderr as way to output status information/reports/warnings that shouldn't get piped to the normal output. IIRC the `tidy` utility does this by default.
Yep, but most can be told to "shutup unless its important", eg tidy -e or Colomban's suggestion for PHP
And if it *is* important then we don't want to do the substitution.
- sadly there are still filters that return zero if they fail and
non-zero if they succeed (especially user written ones :), which means that you can't just test the return value.
Checking exit codes is pretty much the only sane way though and is the exact use for them.
Agreed, it is the proper way, if only Geany did that from the beginning, now we will break any un-sane filters if we change Geany.
Maybe checking exit code to determine success or failure and just having a status bar message if stderr is written to that says something to the effect of "The filter command wrote to the standard error stream, this might indicate a problem in your output." would be the way to go?
Nobody notices status bar messages I'm afraid. And if some of the output is wrong (which is what the message said) then the user may not notice until they have saved the file, oops.
Sadly I don't think there is a solution that is not going to break someone's existing filters, so I suggest the easiest path of just leaving it alone :)
Cheers Lex
Cheers, Matthew Brush
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users