-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Linux] uWSGI: Fix permission denied on subprocess.getoutput #26
base: master
Are you sure you want to change the base?
Conversation
browsers/linux.py
Outdated
version = subprocess.getoutput(f"{executable_path} --version 2>&1").strip() | ||
version = subprocess.check_output([executable_path, "--version"]).decode().strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have to test this later because --version
can sometimes include error messages on some platforms/browsers, hence the 2>&1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency I have added the 2>&1
argument back in.
Do you have an error log which lines was causing the issue? I tried checking out your changes but it fails on Ubuntu, snap-installed browsers.
Looking at the code, I believe it is not related to |
Looks like this is related to chrome trying to write to |
@@ -44,7 +44,7 @@ def browsers() -> Iterator[Browser]: # type: ignore[return] | |||
executable_path = entry.getExec() | |||
if executable_path.lower().endswith(" %u"): | |||
executable_path = executable_path[:-3].strip() | |||
version = subprocess.getoutput(f"{executable_path} --version 2>&1").strip() | |||
version = subprocess.check_output([executable_path, "--version", "2>&1"]).decode().strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = subprocess.check_output([executable_path, "--version", "2>&1"]).decode().strip() | |
version = subprocess.getoutput(f"{executable_path} --no-sandbox --version 2>&1").strip() |
Can you instead try this? --no-sandbox
looks fine on Firefox, too but I certainly did not test it on other browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also advise to run several command line switches like --disable-default-apps
. Not sure which one will solve this issue but you can check https://peter.sh/experiments/chromium-command-line-switches/
Using uWSGI on Linux, Python fails to call subprocess.getoutput method due to a permissions problem.
Using the subprocess.check_output method, no directory creation request is made and the command returns the expected value
To be tested on other OS