boba_dump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from subprocess import run, PIPE RED = '\x1b[31m' CYAN = '\x1b[36m' RESET = '\x1b[0m' class BOBADump: def __init__(self, binary): self.binary = binary def run(self, boba_file_path): command = [self.binary, boba_file_path] result = run(command, stdout=PIPE, stderr=PIPE) stdout = result.stdout.decode() if len(stdout) > 0: print(f'{CYAN}===== Begin standard output for command \'{self.binary}\' ====={RESET}\n', stdout, f'{CYAN}===== End standard output for command \'{self.binary}\' ====={RESET}\n', sep='') stderr = result.stderr.decode() if len(stderr) > 0: print(f'{RED}===== Begin standard error for command \'{self.binary}\' ====={RESET}\n', stderr, f'{RED}===== End standard error for command \'{self.binary}\' ====={RESET}\n', sep='') result.check_returncode() return stdout