(self, args, stdout_list=False, intext=None, inbytes=None, debug_log=True)
| 561 | return os.makedirs(path) |
| 562 | |
| 563 | def run(self, args, stdout_list=False, intext=None, inbytes=None, debug_log=True): |
| 564 | if debug_log: |
| 565 | log.debug(f"run: {args}") |
| 566 | start = datetime.now() |
| 567 | if intext is not None: |
| 568 | inbytes = intext.encode() |
| 569 | p = subprocess.run(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE, |
| 570 | input=inbytes) |
| 571 | stdout_as_list = None |
| 572 | if stdout_list: |
| 573 | try: |
| 574 | out = p.stdout.decode() |
| 575 | if HttpdTestSetup.CURL_STDOUT_SEPARATOR in out: |
| 576 | stdout_as_list = out.split(HttpdTestSetup.CURL_STDOUT_SEPARATOR) |
| 577 | if not stdout_as_list[len(stdout_as_list) - 1]: |
| 578 | stdout_as_list.pop() |
| 579 | p.stdout.replace(HttpdTestSetup.CURL_STDOUT_SEPARATOR.encode(), b'') |
| 580 | except: |
| 581 | pass |
| 582 | return ExecResult(args=args, exit_code=p.returncode, |
| 583 | stdout=p.stdout, stderr=p.stderr, |
| 584 | stdout_as_list=stdout_as_list, |
| 585 | duration=datetime.now() - start) |
| 586 | |
| 587 | def mkurl(self, scheme, hostname, path='/'): |
| 588 | port = self.https_port if scheme == 'https' else self.http_port |
no test coverage detected