From: Constantin Berhard Date: Wed, 9 Oct 2013 19:04:00 +0000 (+0200) Subject: Merge branch 'master' of ralfj.de:saartuer X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/72033b3361e5f60ae1e0086f9326d815e4cec845?hp=d5363aceeb231a73d940a084ec235d832f767b8f Merge branch 'master' of ralfj.de:saartuer --- diff --git a/libtuer.py b/libtuer.py index e0898d5..1f8a034 100644 --- a/libtuer.py +++ b/libtuer.py @@ -1,4 +1,4 @@ -import logging, logging.handlers, os, time, queue, threading, subprocess, multiprocessing +import logging, logging.handlers, os, time, queue, threading, subprocess # logging function class Logger: @@ -29,13 +29,13 @@ logger = 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():