def SendChar(output, lib_id, ret_ptr):
"""Callback function that captures what's sent by ngspice to stdout."""
global send_char_queue
clean_output = "".join(output.decode().split('*'))
if 'stdout' in clean_output:
to_print = ' '.join(clean_output.split(' ')[1:]).strip()
if "ngspice" in to_print and "done" in to_print: # pragma: no cover
send_char_queue.put("Quitting ngspice")
elif "Note: 'quit' asks for detaching ngspice.dll"\
in to_print: # pragma: no cover
pass
elif to_print not in string.whitespace:
send_char_queue.put(to_print)
elif 'stderr' in clean_output: # pragma: no cover
if 'warning' not in clean_output.lower():
raise SystemError(" ".join(clean_output.split(' ')[1:]))
else:
send_char_queue.put(clean_output)
return 0
评论列表
文章目录