(cmd, stdin = None)
| 419 | return arch |
| 420 | |
| 421 | def _run(cmd, stdin = None): |
| 422 | log.debug('%s', subprocess.list2cmdline(cmd)) |
| 423 | try: |
| 424 | proc = subprocess.Popen( |
| 425 | cmd, |
| 426 | stdin = subprocess.PIPE, |
| 427 | stdout = subprocess.PIPE, |
| 428 | stderr = subprocess.PIPE, |
| 429 | universal_newlines = True |
| 430 | ) |
| 431 | stdout, stderr = proc.communicate(stdin) |
| 432 | exitcode = proc.wait() |
| 433 | except OSError as e: |
| 434 | if e.errno == errno.ENOENT: |
| 435 | log.exception('Could not run %r the program', cmd[0]) |
| 436 | else: |
| 437 | raise |
| 438 | |
| 439 | if (exitcode, stderr) != (0, ''): |
| 440 | msg = 'There was an error running %r:\n' |
| 441 | args = cmd, |
| 442 | if exitcode != 0: |
| 443 | msg += 'It had the exitcode %d.\n' |
| 444 | args += exitcode, |
| 445 | if stderr != '': |
| 446 | msg += 'It had this on stdout:\n%s\n' |
| 447 | args += stderr, |
| 448 | log.error(msg, *args) |
| 449 | |
| 450 | return stdout |
| 451 | |
| 452 | @LocalContext |
| 453 | def cpp(shellcode): |
no test coverage detected