def METHOD_NAME(p):
    """Callback for _system."""
    enc = DEFAULT_ENCODING
    def stdout_read():
        for line in read_no_interrupt(p.stdout).splitlines():
            line = line.decode(enc, 'replace')
            print(line, file=sys.stdout)
    def stderr_read():
        for line in read_no_interrupt(p.stderr).splitlines():
            line = line.decode(enc, 'replace')
            print(line, file=sys.stderr)
    Thread(target=stdout_read).start()
    Thread(target=stderr_read).start()
    # Wait to finish for returncode. Unfortunately, Python has a bug where
    # wait() isn't interruptible (https://bugs.python.org/issue28168) so poll in
    # a loop instead of just doing `return p.wait()`.
    while True:
        result = p.poll()
        if result is None:
            time.sleep(0.01)
        else:
            return result