When ouputting to /dev/null should open in write mode

Even though it was working opening the file in 'read' mode, it really
should be opened in 'write' mode, since we are redirecting the output
to the file.

Interestingly it does fail in 'read' mode if the command is:
    echo something

But passes in 'write' mode.

Change-Id: Ic67091881e0be377e527b78d270ab48962881ae0
This commit is contained in:
John L. Villalovos 2018-02-06 23:01:53 -08:00
parent 8873f5eb91
commit 944a77c9c6
1 changed files with 1 additions and 1 deletions

View File

@ -313,7 +313,7 @@ def is_journalctl_present():
:returns: True if journalctl is present, False if not.
"""
try:
devnull = open(os.devnull)
devnull = open(os.devnull, 'w')
subprocess.check_call(['journalctl', '--version'], stdout=devnull,
stderr=devnull)
except OSError as e: