1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

wow, you really do have to open /dev/null to discard the output

This commit is contained in:
Seth Schoen
2012-08-10 18:19:39 -07:00
parent be5c017d9c
commit ebe5e36152
2 changed files with 3 additions and 4 deletions

View File

@@ -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

View File

@@ -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"