-import logging, logging.handlers, os, time, queue, threading, subprocess, multiprocessing
+import logging, logging.handlers, os, time, queue, threading, subprocess
# logging function
class Logger:
# run a command asynchronously and log the return value if not 0
# prefix must be a string identifying the code position where the call came from
def fire_and_forget (cmd, log, prefix):
- def _fire_and_forget (cmd, log, prefix):
+ def _fire_and_forget ():
with open("/dev/null", "w") as fnull:
retcode = subprocess.call(cmd, stdout=fnull, stderr=fnull)
if retcode is not 0:
log("%sReturn code %d at command: %s" % (prefix,retcode,str(cmd)))
- p = multiprocessing.Process(target=_fire_and_forget, args=(cmd,log,prefix))
- p.start()
+ t = threading.Thread(target=_fire_and_forget)
+ t.start()
# Threaded callback class
class ThreadFunction():