Make non-remote commands work.

This commit is contained in:
Florent Le Coz 2011-12-15 20:29:20 +01:00
parent a6b1a1d4d8
commit 0b2037a67c
2 changed files with 8 additions and 2 deletions

View file

@ -54,6 +54,7 @@ from keyboard import read_char
from theming import get_theme from theming import get_theme
from fifo import Fifo from fifo import Fifo
from windows import g_lock from windows import g_lock
from daemon import Executor
# http://xmpp.org/extensions/xep-0045.html#errorstatus # http://xmpp.org/extensions/xep-0045.html#errorstatus
ERROR_AND_STATUS_CODES = { ERROR_AND_STATUS_CODES = {
@ -2143,7 +2144,8 @@ class Core(object):
self.information('Could not execute [%s]: %s' % (command.strip(), e,), 'Error') self.information('Could not execute [%s]: %s' % (command.strip(), e,), 'Error')
self.remote_fifo = None self.remote_fifo = None
else: else:
pass e = Executor(command.strip())
e.start()
def get_conversation_messages(self): def get_conversation_messages(self):
""" """

View file

@ -23,6 +23,10 @@ import sys
import threading import threading
import subprocess import subprocess
import logging
log = logging.getLogger(__name__)
class Executor(threading.Thread): class Executor(threading.Thread):
""" """
Just a class to execute commands in a thread. Just a class to execute commands in a thread.
@ -35,7 +39,7 @@ class Executor(threading.Thread):
self.command = command self.command = command
def run(self): def run(self):
print('executing %s' % (self.command.strip(),)) log.info('executing %s' % (self.command.strip(),))
subprocess.call(self.command.split()) subprocess.call(self.command.split())
def main(): def main():