From ebe5e3615297c896dd227dbf0a440aeb82f4f8a2 Mon Sep 17 00:00:00 2001 From: Seth Schoen Date: Fri, 10 Aug 2012 18:19:39 -0700 Subject: [PATCH] wow, you really do have to open /dev/null to discard the output --- client-webserver/client.py | 3 +-- client-webserver/configurator.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client-webserver/client.py b/client-webserver/client.py index efd918226..1a6158cb1 100755 --- a/client-webserver/client.py +++ b/client-webserver/client.py @@ -141,13 +141,12 @@ def drop_privs(): os.setuid(nobody) def make_request(server, m, csr, quiet=False): - print quiet m.request.recipient = server m.request.timestamp = int(time.time()) m.request.csr = csr hashcash_cmd = ["hashcash", "-P", "-m", "-z", "12", "-b", `difficulty`, "-r", server] if quiet: - hashcash = subprocess.check_output(hashcash_cmd, preexec_fn=drop_privs, shell=False, stderr=None).rstrip() + hashcash = subprocess.check_output(hashcash_cmd, preexec_fn=drop_privs, shell=False, stderr=open("/dev/null", "w")).rstrip() else: hashcash = subprocess.check_output(hashcash_cmd, preexec_fn=drop_privs, shell=False).rstrip() if hashcash: m.request.clientpuzzle = hashcash diff --git a/client-webserver/configurator.py b/client-webserver/configurator.py index de6d65b8f..92bf9773e 100644 --- a/client-webserver/configurator.py +++ b/client-webserver/configurator.py @@ -346,7 +346,7 @@ class Configurator(object): Checks apache2ctl to get loaded module list """ try: - p = subprocess.check_output(["sudo", "/usr/sbin/apache2ctl", "-M"], stderr=open("/dev/null")) + p = subprocess.check_output(["sudo", "/usr/sbin/apache2ctl", "-M"], stderr=open("/dev/null", "w")) except: print "Error accessing apache2ctl for loaded modules!" print "This may be caused by an Apache Configuration Error" @@ -386,7 +386,7 @@ class Configurator(object): """ # Use check_output so the command will finish before reloading the server subprocess.check_output(["sudo", "a2enmod", "ssl"]) - subprocess.call(["sudo", "/etc/init.d/apache2", "reload"], stdout=None, stderr=None) + subprocess.call(["sudo", "/etc/init.d/apache2", "reload"], stdout=open("/dev/null", "w"), stderr=open("/dev/null", "w")) """ a_conf = SERVER_ROOT + "mods-available/ssl.conf" a_load = SERVER_ROOT + "mods-available/ssl.load"