If I run
(setq some-variable (shell-command-to-string some-command))
...and the execution of the command in some-command results in some output sent to stderr, this stderr output ends up in some-variable.
How can I discard the stderr output, so that the result consists exclusively of the output sent to stdout? (Better yet would be to capture the stdout and stderr outputs in separate variables.)
Note that it is not enough to add something like 2>/dev/null to the command in some-command, because the stderr output may come from a shell initialization file (e.g. .bashrc), and thus would not be captured by the 2>/dev/null redirection.
shell-command-default-error-buffervariable? – Nsukami _ Apr 04 '16 at 17:27shell-commandandshell-command-on-region... At any rate, I have not been able to come up with a setting for it that produces a different behavior from the default one. – kjo Apr 04 '16 at 18:42