summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/execute.py
diff options
context:
space:
mode:
Diffstat (limited to 'rtemstoolkit/execute.py')
-rwxr-xr-xrtemstoolkit/execute.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index 7c168af..90ddce0 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -43,6 +43,7 @@ import sys
import subprocess
import threading
import time
+import traceback
#
# Support to handle use in a package and as a unit test.
@@ -138,7 +139,7 @@ class execute(object):
block and return None or False if this thread is to exit and True if this
is a timeout check."""
if trace_threads:
- print('executte:_writethread: start')
+ print('execute:_writethread: start')
encoding = True
try:
tmp = bytes('temp', sys.stdin.encoding)
@@ -146,7 +147,9 @@ class execute(object):
encoding = False
try:
while True:
- lines = eval(input())
+ if trace_threads:
+ print('execute:_writethread: call input', input)
+ lines = input()
if type(lines) == str or type(lines) == bytes:
try:
if encoding:
@@ -160,14 +163,15 @@ class execute(object):
break
except:
if trace_threads:
- print('executte:_writethread: exception')
+ print('execute:_writethread: exception')
+ print(traceback.format_exc())
pass
try:
fh.close()
except:
pass
if trace_threads:
- print('executte:_writethread: finished')
+ print('execute:_writethread: finished')
def _readthread(exe, fh, out, prefix = ''):
"""Read from a file handle and write to the output handler
@@ -184,7 +188,7 @@ class execute(object):
log.flush()
if trace_threads:
- print('executte:_readthread: start')
+ print('execute:_readthread: start')
count = 0
line = ''
try:
@@ -206,7 +210,8 @@ class execute(object):
except:
raise
if trace_threads:
- print('executte:_readthread: exception')
+ print('execute:_readthread: exception')
+ print(traceback.format_exc())
pass
try:
fh.close()
@@ -215,7 +220,7 @@ class execute(object):
if len(line):
_output_line(line, exe, prefix, out, 100)
if trace_threads:
- print('executte:_readthread: finished')
+ print('execute:_readthread: finished')
def _timerthread(exe, interval, function):
"""Timer thread is used to timeout a process if no output is