Commit 65e5a910 by Czémán Arnold

is_there_systemd() with with

parent bdfbc9e7
......@@ -65,13 +65,11 @@ def ns_exec(args, stdin=None):
def is_there_systemd():
devnull = open(os.devnull, "w")
try:
sp.call(["/bin/systemctl", "--version"], stdout=devnull, stderr=devnull)
except OSError:
return False
finally:
devnull.close()
with open(os.devnull, "w") as devnull:
try:
sp.call(["/bin/systemctl", "--version"], stdout=devnull, stderr=devnull)
except OSError:
return False
return True
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment