pingnet: Fix ResourceWarning
parent
ef6d435d8d
commit
10e5548513
|
@ -64,9 +64,10 @@ class Pinger(threading.Thread):
|
|||
break
|
||||
|
||||
def ping(self, host):
|
||||
with open(os.devnull, 'r+') as nul:
|
||||
p = subprocess.Popen(['ping', '-c', '1', '-W', '1', host],
|
||||
stdin=open(os.devnull),
|
||||
stdout=open(os.devnull, 'w'),
|
||||
stdin=nul,
|
||||
stdout=nul,
|
||||
stderr=subprocess.STDOUT)
|
||||
p.wait()
|
||||
if p.returncode == 0:
|
||||
|
|
Loading…
Reference in New Issue