Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Commit 8cbc73e

Browse files
penrodsaatchison
authored andcommitted
Added same kind of hack for mycroft-speech-client
1 parent b6cc47a commit 8cbc73e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

mycroft/client/speech/main.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,24 @@ def handle_open():
178178
# Reset the UI to indicate ready for speech processing
179179
EnclosureAPI(ws).reset()
180180

181+
# TEMPORARY HACK: Look for multiple instance of the mycroft-speech-client
182+
# which could happen when upgrading a shipping Mark 1 from release 0.8.17
183+
# or before. When found, force the unit to reboot...
184+
import psutil
185+
import subprocess
186+
count_instances = 0
187+
for process in psutil.process_iter():
188+
if process.cmdline() == ['python2.7',
189+
'/usr/local/bin/mycroft-speech-client']:
190+
count_instances += 1
191+
if (count_instances > 1):
192+
ws.emit(Message("enclosure.eyes.spin"))
193+
ws.emit(Message("enclosure.mouth.reset"))
194+
time.sleep(0.5) # Allows system time to start the eyes spinning
195+
subprocess.call('systemctl reboot -i', shell=True)
196+
# END HACK
197+
# TODO: Remove this hack ASAP
198+
181199

182200
def connect():
183201
ws.run_forever()

0 commit comments

Comments
 (0)