INNER CODE UNIT · Python
command_output
piku/piku · piku.py:328
def command_output(cmd):
"""executes a command and grabs its output, if any"""
try:
env = environ
return str(check_output(cmd, stderr=STDOUT, env=env, shell=True).decode())
except Exception:
return ""
def get_nginx_ssl_config():
"""Detect nginx version and return (ssl_listen, http2_directive) tuple.
nginx >=1.25.1 uses a separate 'http2 on;' directive.
Older versions append 'http2' to the listen line."""
nginx = command_output("nginx -V")
nginx_ssl = "443 ssl"
nginx_http2 = ""
if "--with-http_v2_module" in nginx: