summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xbin/network10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/network b/bin/network
index 73d7584..cf20bd7 100755
--- a/bin/network
+++ b/bin/network
@@ -458,8 +458,9 @@ def can_ping(the_interface, test_target):
working_interface = True
try:
- check_call(["ping", "-I", the_interface, "-c", "1", test_target],
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ with open(os.devnull, 'wb') as DEVNULL:
+ check_call(["ping", "-I", the_interface, "-c", "1", test_target],
+ stdout=DEVNULL, stderr=DEVNULL)
except CalledProcessError as excp:
working_interface = False
logging.warning("Ping failure on %s (%s)", the_interface, excp)
@@ -577,8 +578,9 @@ def interface_test(args):
temp.seek(0)
try:
# Harmless "RTNETLINK answers: File exists" messages on stderr
- check_call(["ip", "route", "restore"], stdin=temp,
- stderr=subprocess.DEVNULL)
+ with open(os.devnull, 'wb') as DEVNULL:
+ check_call(["ip", "route", "restore"], stdin=temp,
+ stderr=DEVNULL)
except CalledProcessError as restore_failure:
logging.warning("Unable to restore routing table: %s", restore_failure)
temp.close()