fix gemm segfault
print exit signals on validation failure
This commit is contained in:
@@ -4,6 +4,8 @@ import pty
|
||||
import selectors
|
||||
import subprocess
|
||||
|
||||
MAX_ERROR_OUTPUT_BYTES = 8192
|
||||
|
||||
|
||||
def _read_chunk(fd, treat_eio_as_eof=False):
|
||||
try:
|
||||
@@ -16,6 +18,7 @@ def _read_chunk(fd, treat_eio_as_eof=False):
|
||||
|
||||
def _stream_output(fd, process, reporter, treat_eio_as_eof=False):
|
||||
selector = selectors.DefaultSelector()
|
||||
recent_output = bytearray()
|
||||
|
||||
try:
|
||||
selector.register(fd, selectors.EVENT_READ)
|
||||
@@ -31,12 +34,15 @@ def _stream_output(fd, process, reporter, treat_eio_as_eof=False):
|
||||
reporter._clear()
|
||||
os.write(1, data)
|
||||
reporter._render()
|
||||
recent_output.extend(data)
|
||||
if len(recent_output) > MAX_ERROR_OUTPUT_BYTES:
|
||||
del recent_output[:-MAX_ERROR_OUTPUT_BYTES]
|
||||
finally:
|
||||
selector.close()
|
||||
|
||||
return_code = process.wait()
|
||||
if return_code != 0:
|
||||
raise subprocess.CalledProcessError(return_code, process.args)
|
||||
raise subprocess.CalledProcessError(return_code, process.args, output=bytes(recent_output))
|
||||
|
||||
|
||||
def run_command_with_reporter(cmd, cwd=None, reporter=None):
|
||||
|
||||
Reference in New Issue
Block a user