Skip to content
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

contrib: bugfix: allow empty user.ghtoken #775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stickies-v
Copy link
Contributor

subprocess.run() does not throw a CalledProcessError when the process exits with a non-zero exit code, unless check=True is set. This means that when the option key is not found, an empty string is returned instead, causing a wrong ghtoken to be used for the Authorization header.

This leads to:

% ./contrib/new_post.py 30239 <author> 2024-11-06
Github returned error HTTP Error 401: Unauthorized

Fix this and simplify the code by using the convenience function subprocess.check_output() instead.

Addresses #764 (comment)

subprocess.run() does not throw a CalledProcessError when the
process exits with a non-zero exit code, unless `check=True` is
set. This means that when the `option` key is not found, an
empty string is returned instead, causing a wrong ghtoken
to be used for the `Authorization` header.

This leads to:
Github returned error HTTP Error 401: Unauthorized

Fix this and simplify the code by using the convenience
function `subprocess.check_output()` instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant