Commit 35d20f38 authored by Guillaume Seguin's avatar Guillaume Seguin

Adapt niceness detection for psutil < 2.0

parent 1eb78fe5
...@@ -81,7 +81,10 @@ try: ...@@ -81,7 +81,10 @@ try:
if platform.system() != "Windows": if platform.system() != "Windows":
p = psutil.Process(os.getpid()) p = psutil.Process(os.getpid())
nice_limit, _ = p.rlimit(psutil.RLIMIT_NICE) if hasattr(p, "rlimit"):
nice_limit, _ = p.rlimit(psutil.RLIMIT_NICE)
else:
nice_limit, _ = p.get_rlimit(psutil.RLIMIT_NICE)
high_priority_nice = 20 - nice_limit high_priority_nice = 20 - nice_limit
def set_nice(nice): def set_nice(nice):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment