Start program in seperate thread
This commit is contained in:
parent
10e7638511
commit
f5b5ef4c36
1 changed files with 5 additions and 4 deletions
|
@ -13,6 +13,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import _thread
|
||||||
|
|
||||||
CHANNEL = "w"
|
CHANNEL = "w"
|
||||||
IS_WALLABY = is_wallaby()
|
IS_WALLABY = is_wallaby()
|
||||||
|
@ -34,9 +35,8 @@ class WallabyControl(Routing.ClientRoute):
|
||||||
self.actions_without_params[data](handler)
|
self.actions_without_params[data](handler)
|
||||||
elif type(data) is dict:
|
elif type(data) is dict:
|
||||||
for action in data:
|
for action in data:
|
||||||
print(action)
|
|
||||||
if action in self.actions_with_params.keys():
|
if action in self.actions_with_params.keys():
|
||||||
self.actions_with_params[action](handler, data[action])
|
_thread.start_new_thread(self.actions_with_params[action], (handler, data[action]))
|
||||||
|
|
||||||
|
|
||||||
def run_program(self, handler, program):
|
def run_program(self, handler, program):
|
||||||
|
@ -58,9 +58,10 @@ class WallabyControl(Routing.ClientRoute):
|
||||||
|
|
||||||
def stop(self, handler):
|
def stop(self, handler):
|
||||||
if self.currently_running_program != None:
|
if self.currently_running_program != None:
|
||||||
Logging.info("Killed currently running programm.")
|
Logging.info("Killing currently running programm.")
|
||||||
self.currently_running_program.kill()
|
self.currently_running_program.kill()
|
||||||
Logging.info("No program started by fl0w.")
|
else:
|
||||||
|
Logging.info("No program started by fl0w.")
|
||||||
|
|
||||||
|
|
||||||
def reboot(self, handler):
|
def reboot(self, handler):
|
||||||
|
|
Reference in a new issue