bobadump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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, text=True) if len(result.stdout) > 0: print(f'{CYAN}===== Begin standard output for command \'{self.binary}\' ====={RESET}\n', result.stdout, f'{CYAN}===== End standard output for command \'{self.binary}\' ====={RESET}\n', sep='') if len(result.stderr) > 0: print(f'{RED}===== Begin standard error for command \'{self.binary}\' ====={RESET}\n', result.stderr, f'{RED}===== End standard error for command \'{self.binary}\' ====={RESET}\n', sep='') result.check_returncode() return result.stdout