Skip output lines that have UTF8 decoding error (#441)
* Avoid crash if non-UTF8 character is encountered in output
Signed-off-by: benrichard-amd <ben.richard@amd.com>
* Ignore lines with non-UTF-8 characters. Do not print error.
Signed-off-by: benrichard-amd <ben.richard@amd.com>
* Remove trailing whitespace
Signed-off-by: benrichard-amd <ben.richard@amd.com>
---------
Signed-off-by: benrichard-amd <ben.richard@amd.com>
[ROCm/rocprofiler-compute commit: fb210abcd0]
Этот коммит содержится в:
@@ -205,14 +205,18 @@ def capture_subprocess_output(subprocess_args, new_env=None, profileMode=False):
|
||||
buf = io.StringIO()
|
||||
|
||||
def handle_output(stream, mask):
|
||||
# Because the process' output is line buffered, there's only ever one
|
||||
# line to read when this function is called
|
||||
line = stream.readline()
|
||||
buf.write(line)
|
||||
if profileMode:
|
||||
console_log(rocprof_cmd, line.strip(), indent_level=1)
|
||||
else:
|
||||
console_log(line.strip())
|
||||
try:
|
||||
# Because the process' output is line buffered, there's only ever one
|
||||
# line to read when this function is called
|
||||
line = stream.readline()
|
||||
buf.write(line)
|
||||
if profileMode:
|
||||
console_log(rocprof_cmd, line.strip(), indent_level=1)
|
||||
else:
|
||||
console_log(line.strip())
|
||||
except UnicodeDecodeError:
|
||||
# Skip this line
|
||||
pass
|
||||
|
||||
# Register callback for an "available for read" event from subprocess' stdout stream
|
||||
selector = selectors.DefaultSelector()
|
||||
|
||||
Ссылка в новой задаче
Block a user