mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Avoid UnicodeDecodeError when reading nmap output. See #3087
This commit is contained in:
@@ -198,7 +198,8 @@ class NmapCommand(object):
|
|||||||
# We don't need a file name for stdout output, just a handle. A
|
# We don't need a file name for stdout output, just a handle. A
|
||||||
# TemporaryFile is deleted as soon as it is closed, and in Unix is
|
# TemporaryFile is deleted as soon as it is closed, and in Unix is
|
||||||
# unlinked immediately after creation so it's not even visible.
|
# unlinked immediately after creation so it's not even visible.
|
||||||
f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8")
|
f = tempfile.TemporaryFile(mode="r", prefix=APP_NAME + "-stdout-", encoding="utf-8",
|
||||||
|
errors='backslashreplace')
|
||||||
self.stdout_file = f
|
self.stdout_file = f
|
||||||
if stderr is None:
|
if stderr is None:
|
||||||
stderr = f
|
stderr = f
|
||||||
|
|||||||
Reference in New Issue
Block a user