forked from p15670423/monkey
Agent: Automatically select correct output encoding for ping command
This commit is contained in:
parent
f2148db70b
commit
769dd67b66
|
@ -43,13 +43,12 @@ class PingScanner(HostScanner, HostFinger):
|
||||||
if not "win32" == sys.platform:
|
if not "win32" == sys.platform:
|
||||||
timeout /= 1000
|
timeout /= 1000
|
||||||
|
|
||||||
Encoding = "cp850"
|
|
||||||
sub_proc = subprocess.Popen(
|
sub_proc = subprocess.Popen(
|
||||||
["ping", PING_COUNT_FLAG, "1", PING_TIMEOUT_FLAG, str(timeout), host.ip_addr],
|
["ping", PING_COUNT_FLAG, "1", PING_TIMEOUT_FLAG, str(timeout), host.ip_addr],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
text=True,
|
text=True,
|
||||||
encoding=Encoding,
|
encoding=os.device_encoding(1),
|
||||||
)
|
)
|
||||||
|
|
||||||
output = " ".join(sub_proc.communicate())
|
output = " ".join(sub_proc.communicate())
|
||||||
|
|
Loading…
Reference in New Issue