Skip to content

Commit

Permalink
Fix launchctl bootout call
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuron committed Feb 6, 2017
1 parent 057f2d0 commit b186a53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mountclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ def log(msg):
if len(extraps) == 0:
kill_users.append(user)

uid = pwd.getpwnam(user).pw_uid
if int(os.uname()[2].split('.')[0]) >= 15: # launchctl bootout was introduced by macOS 10.11
log("Shutting down launchd user domain")
subprocess.call(['/bin/launchctl', 'bootout', 'user/' + user])
subprocess.call(['/bin/launchctl', 'bootout', 'user/' + str(uid)])
else:
log("Shutting down launchd per-user bootstrap")
uid = pwd.getpwnam(user).pw_uid
subprocess.call(['/bin/launchctl', 'remove', 'com.apple.launchd.peruser.' + str(uid)])

if len(kill_users) > 0:
Expand Down

0 comments on commit b186a53

Please sign in to comment.