Merge lp:~markhor/light-locker-settings/fix_get_pid_list into lp:light-locker-settings

Proposed by Markhor
Status: Needs review
Proposed branch: lp:~markhor/light-locker-settings/fix_get_pid_list
Merge into: lp:light-locker-settings
Diff against target: 17 lines (+6/-1)
1 file modified
light-locker-settings/light-locker-settings.py (+6/-1)
To merge this branch: bzr merge lp:~markhor/light-locker-settings/fix_get_pid_list
Reviewer Review Type Date Requested Status
Light Locker Settings Team Pending
Review via email: mp+289556@code.launchpad.net

Commit message

Fix work with newer psutil

  Problem:
  https://bbs.archlinux.org/viewtopic.php?id=199003

  Cause:
  https://github.com/giampaolo/psutil/commit/fc8592a482c1232da33366a95ddd62a99130534a

  So psutil >= 2.0.0 breaks light-locker-settings.py

  Solution:
  Try both API variants

Description of the change

Fix work with newer psutil

  Problem:
  https://bbs.archlinux.org/viewtopic.php?id=199003

  Cause:
  https://github.com/giampaolo/psutil/commit/fc8592a482c1232da33366a95ddd62a99130534a

  So psutil >= 2.0.0 breaks light-locker-settings.py

  Solution:
  Try both API variants

To post a comment you must log in.
151. By Markhor

Fix work with newer psutil

  Problem:
  https://bbs.archlinux.org/viewtopic.php?id=199003

  Cause:
  https://github.com/giampaolo/psutil/commit/fc8592a482c1232da33366a95ddd62a99130534a

  So psutil >= 2.0.0 breaks light-locker-settings.py

  Solution:
  Try both API variants

Unmerged revisions

151. By Markhor

Fix work with newer psutil

  Problem:
  https://bbs.archlinux.org/viewtopic.php?id=199003

  Cause:
  https://github.com/giampaolo/psutil/commit/fc8592a482c1232da33366a95ddd62a99130534a

  So psutil >= 2.0.0 breaks light-locker-settings.py

  Solution:
  Try both API variants

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'light-locker-settings/light-locker-settings.py'
2--- light-locker-settings/light-locker-settings.py 2015-06-09 17:06:49 +0000
3+++ light-locker-settings/light-locker-settings.py 2016-03-19 08:26:11 +0000
4@@ -218,7 +218,12 @@
5 def check_running_process(self, process_name):
6 """Return True if the specified process is active."""
7 # Find the process...
8- for pid in psutil.get_pid_list():
9+ try:
10+ # since 2.0.0 - 2014-03-10
11+ pids = psutil.pids()
12+ except AttributeError:
13+ pids = psutil.get_pid_list()
14+ for pid in pids:
15 try:
16 p = psutil.Process(pid)
17 if self.get_process_username(p) == username:

Subscribers

People subscribed via source and target branches