Bopytex/bopytex/message.py

38 lines
737 B
Python
Raw Permalink Normal View History

2022-07-28 07:39:51 +00:00
class Message:
2022-04-13 10:26:04 +00:00
def __init__(self, status, out, err):
self._status = status
self._out = out
self._err = err
@property
def status(self):
return self._status
@property
def out(self):
return self._out
@property
def err(self):
return self._err
def __repr__(self):
return f"Message(status={self.status}, out={self.out}, err={self.err})"
2022-07-28 07:39:51 +00:00
2022-04-13 10:26:04 +00:00
class SubprocessMessage(Message):
def __init__(self, process):
self._process = process
@property
def status(self):
return self._process.wait()
@property
def out(self):
return self._process.stdout
@property
def err(self):
return self._process.stderr