-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using --print-settings
, error message should go to STDERR, not STDOUT
#3342
Comments
Not sure where to put this snippet into the Pelican code base because it is missing a "front-end" binary for use with UNINSTALLED Pelican package (commonly used when testing UNINSTALLED Pelican). Why is this A working snippet for #!python
# -*- coding: utf-8 -*-
import re
import sys
import logging
from pelican.__main__ import main
class InfoFilter(logging.Filter):
def filter(self, rec):
return rec.levelno in (logging.DEBUG, logging.INFO)
logger = logging.getLogger("__name__")
logger.setLevel(logging.DEBUG)
h1 = logging.StreamHandler(sys.stdout)
h1.setLevel(logging.DEBUG)
h1.addFilter(InfoFilter())
h2 = logging.StreamHandler()
h2.setLevel(logging.WARNING)
logger.addHandler(h1)
logger.addHandler(h2)
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
sys.exit(main()) |
When we type in |
Ordinarily, yes. I tried a few things from coreutils and that seems to be the case. A couple of other common utilities (mpg123, gcc, make) as well. For whatever it's worth, I just ran |
Issue
When attempting to automate the setup of Pelican using bash, the STDOUT output of the command
pelican --print-settings VAR
gets cluttered with non-related info.Confirmed that these WARNING outputs are using fd=1 (STDOUT) using
strace -s132 -f pelican --print-settings PATH
.Ideally, these WARNINGS (and INFO and whatnots) should be outputted to UNIX STDERR so that we can better handle error scenario in GitHub Actions or other CIs as well.
The text was updated successfully, but these errors were encountered: