1
0

proj: Add pid to msg()

This commit is contained in:
2025-04-14 17:05:40 +02:00
parent a738e3ee2b
commit e851f5b90d
5 changed files with 16 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ class Handler(StreamRequestHandler):
def handle(self):
first = self.rfile.readline()
meta = {a[0]: a[1] for a in [tuple(p.decode('utf-8').split(':', 1)) for p in first.split(b' ', 1)[1].strip().split(b';')]}
meta = {a[0]: a[1] for a in [tuple(p.decode('utf-8').split(':', 1)) for p in first.split(b' ', 2)[2].strip().split(b';')]}
self.pid = int(meta['PID']) if 'PID' in meta else None
self.path = meta['PATH'] if 'PATH' in meta else None
self.stack = []
@@ -163,7 +163,7 @@ class Handler(StreamRequestHandler):
return tuple(args), idx
def handle_msg(self, msg: bytes):
timestamp, data = msg.rstrip(b'\n').split(b' ', 1)
timestamp, pid, data = msg.rstrip(b'\n').split(b' ', 2)
if not data.startswith(b'return ') and not data == b'return':
call = data.decode('utf-8')
print(f'[{self.pid}] {call}')