Something went wrong. Try again.
minimal agent cli memoria.tools
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243#!/usr/bin/env python3"""Drive one memoria binary against the fake provider with a long responseand dump the emulated final screen to stdout. Usage: run_long.py <binary>"""
import osimport ptyimport selectimport sysimport time
binary = sys.argv[1]pid, fd = pty.fork()if pid == 0: os.environ["MEMORIA_PROVIDER"] = "fake" os.execv(binary, [binary])
out = b""
def pump(t): global out end = time.time() + t while time.time() < end: r, _, _ = select.select([fd], [], [], 0.1) if r: try: out += os.read(fd, 65536) except OSError: return time.sleep(0.05)
pump(1.0)os.write(fd, b"foobar\r")pump(4.0) # let the long response stream in and several repaint frames passos.write(fd, b"\x03")pump(0.5)try: os.close(fd)except OSError: passsys.stdout.write(out.decode("utf-8", "replace"))