def install_handles(self, device): Terminator(device, delim=b'\n') regstr0 = '\> (.+)\(([0-9]+)\).+' RegexEvent(device, regstr0, 'LINE', self.encoding) xmap(device, 'LINE', self.handle_line)
def install_handles(self, device): Terminator(device, delim=b'\n') regstr0 = 'break in (.+):([0-9]+)' RegexEvent(device, regstr0, 'LINE', self.encoding) xmap(device, 'LINE', self.handle_line) # Should be case insensitive. regstr1 = 'Break on .+ in (.+):([0-9]+)' RegexEvent(device, regstr1, 'LINE', self.encoding) xmap(device, 'LINE', self.handle_line)
def create_process(self, args): self.expect = Expect(*args) # Note: The data has to be decoded using the area charset # because the area contents would be sometimes printed along # the debugging. xmap( self.expect, LOAD, lambda con, data: sys.stdout.write(data.decode(self.area.charset))) # The expect has to be passed here otherwise when # starting the new one gets terminated. xmap(self.expect, CLOSE, self.on_bkpipe) self.install_handles(self.expect) root.protocol("WM_DELETE_WINDOW", self.on_tk_quit)
def create_process(self, args): from os import environ, setsid self.child = Popen(args, shell=0, stdout=PIPE, stdin=PIPE, preexec_fn=setsid, stderr=STDOUT, env=environ) self.stdout = Device(self.child.stdout) self.stdin = Device(self.child.stdin) Stdout(self.stdout) Terminator(self.stdout, delim=b'\n') Stdin(self.stdin) PdbEvents(self.stdout, self.encoding) xmap(self.stdout, LOAD, lambda con, data: sys.stdout.write(data)) xmap(self.stdout, 'LINE', self.handle_line) xmap(self.stdout, 'DELETED_BREAKPOINT', self.handle_deleted_breakpoint) xmap(self.stdout, 'BREAKPOINT', self.handle_breakpoint) xmap(self.stdin, CLOSE, lambda dev, err: lose(dev)) xmap(self.stdout, CLOSE, lambda dev, err: lose(dev))