--- a/etherlab/runtime_etherlab.py Mon Apr 22 09:30:48 2013 +0200
+++ b/etherlab/runtime_etherlab.py Mon Apr 22 23:54:22 2013 +0200
@@ -1,4 +1,4 @@
-import subprocess,sys,ctypes
+import os,subprocess,sys,ctypes from threading import Thread
from targets.typemapping import LogLevelsDict
@@ -8,19 +8,20 @@
SDOAnswered.argtypes = []
def SDOThreadProc(*params):
if params[0] == "upload":
cmdfmt = "ethercat upload -p %d -t %s 0x%.4x 0x%.2x"
cmdfmt = "ethercat download -p %d -t %s 0x%.4x 0x%.2x %s"
command = cmdfmt % params[1:]
- proc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
- output = proc.communicate()[0]
+ SDOProc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) + output = SDOProc.communicate()[0] if params[0] == "upload":
@@ -96,7 +97,12 @@
def _runtime_etherlab_cleanup():
- global KMSGPollThread, StopKMSGThread
+ global KMSGPollThread, StopKMSGThread, SDOProc, SDOThread + os.kill(SDOProc.pid, SIGTERM)