Skip to content

Commit

Permalink
Make change backwards-compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Oct 22, 2014
1 parent 5b019c5 commit 82da9aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion psrecord/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ def monitor(pid, logfile=None, plot=None, duration=None, interval=None, include_
# Find current time
current_time = time.time()

try:
pr_status = pr.status()
except TypeError: # psutil < 2.0
pr_status = pr.status

# Check if process status indicates we should exit
if pr.status() in [psutil.STATUS_ZOMBIE, psutil.STATUS_DEAD]:
if pr_status in [psutil.STATUS_ZOMBIE, psutil.STATUS_DEAD]:
print("Process finished ({:.2} seconds)"
.format(current_time - start_time))
break
Expand Down

0 comments on commit 82da9aa

Please sign in to comment.