X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_bin%2Fnotifyd.py;h=312c9b0ad9b8b9df7669678ce64bed39ca8904ae;hb=6aedfb498f029c41fcddbd3925c9a2a3e7eb1d07;hp=cf94ee6e2118afc58af92599a5252b50cf4c1e8c;hpb=2730349817677b4a3130e227bfca296a5a040b66;p=grml-scripts.git diff --git a/usr_bin/notifyd.py b/usr_bin/notifyd.py index cf94ee6..312c9b0 100755 --- a/usr_bin/notifyd.py +++ b/usr_bin/notifyd.py @@ -20,7 +20,7 @@ """ -example of ~/.notifid.conf: +example of ~/.notifyd.conf: --------------------------- import os @@ -47,6 +47,7 @@ import string import socket import logging import getopt +import subprocess default_hostname = 'localhost' default_port = 1234 @@ -58,12 +59,13 @@ default_logfile = None def play(sound_file): def play_wrapper(msg): - os.system('/usr/bin/aplay "%s" 2> /dev/null &' % sound_file) + with open(os.devnull, 'w') as devnull: + subprocess.Popen(['/usr/bin/aplay', sound_file], stderr=devnull) return play_wrapper def execute(command): def command_wrapper(msg): - os.system(command % dict(msg = msg)) + subprocess.call(command % dict(msg = msg)) return command_wrapper def osd(msg):