add subprcess_command for external calling

This commit is contained in:
chrys 2016-10-18 19:04:04 +02:00
parent ca87c7694b
commit 227bd99fb4
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,29 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from core import debug
import subprocess, os
class command():
def __init__(self):
pass
def initialize(self, environment, scriptPaht=''):
self.env = environment
self.scriptPath = scriptPath
def shutdown(self):
pass
def getDescription(self):
return 'script: '+ self.scriptPath
def run(self):
p = Popen(self.scriptPath , stdout=PIPE, stderr=PIPE, shell=True)
stdout, stderr = p.communicate()
self.env['runtime']['outputManager'].interruptOutput()
if stderr != '':
self.env['runtime']['outputManager'].presentText(stdout , soundIcon='', interrupt=False)
if stdout != ''
self.env['runtime']['outputManager'].presentText(stdout , soundIcon='', interrupt=False)
def setCallback(self, callback):
pass

View File

@ -17,7 +17,6 @@ class command():
return ''
def run(self):
self.env['runtime']['outputManager'].interruptOutput()
def setCallback(self, callback):