Skip to content

Commit

Permalink
Remove git locks when starting mycroft (#1715)
Browse files Browse the repository at this point in the history
This is a preventative measure to fix errors with git lock files not being removed when devices are unplugged or processes are killed
  • Loading branch information
MatthewScholefield authored and Steve Penrod committed Aug 3, 2018
1 parent f8a17c0 commit d49d991
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mycroft/skills/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,16 @@ def load_priority(self):
continue
self._load_or_reload_skill(skill.path)

def remove_git_locks(self):
"""If git gets killed from an abrupt shutdown it leaves lock files"""
for i in glob(join(self.msm.skills_dir, '*/.git/index.lock')):
LOG.warning('Found and removed git lock file: ' + i)
os.remove(i)

def run(self):
""" Load skills and update periodically from disk and internet """

# Load priority skills first, in order (very first time this will
# occur before MSM has run)

self.remove_git_locks()
self._connected_event.wait()
has_loaded = False

Expand Down

0 comments on commit d49d991

Please sign in to comment.