Created
August 9, 2019 14:54
-
-
Save cvoltz/7198bddcf3d1f994cbd1bbec5d3db14a to your computer and use it in GitHub Desktop.
Patch to dropbox.py to get the correct PID when running Dropbox via flatpak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- dropbox.py | |
+++ dropbox.py | |
@@ -134,11 +134,12 @@ | |
FatalVisibleError("Platform not supported") | |
def is_dropbox_running(): | |
- pidfile = os.path.expanduser("~/.dropbox/dropbox.pid") | |
- | |
try: | |
- with open(pidfile, "r") as f: | |
- pid = int(f.read()) | |
+ pid = subprocess.run("flatpak ps | awk '/dropbox/ { print $2 }'", | |
+ shell=True, encoding="UTF-8", | |
+ stdout=subprocess.PIPE) | |
+ pid = int(pid.stdout.strip()) | |
+ | |
with open("/proc/%d/cmdline" % pid, "r") as f: | |
cmdline = f.read().lower() | |
except: | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For issue flathub/com.dropbox.Client#43