(cmd, successful_status=(0,), stacklevel=1)
| 25 | |
| 26 | |
| 27 | def getoutput(cmd, successful_status=(0,), stacklevel=1): |
| 28 | try: |
| 29 | status, output = getstatusoutput(cmd) |
| 30 | except OSError as e: |
| 31 | warnings.warn(str(e), UserWarning, stacklevel=stacklevel) |
| 32 | return False, "" |
| 33 | if os.WIFEXITED(status) and os.WEXITSTATUS(status) in successful_status: |
| 34 | return True, output |
| 35 | return False, output |
| 36 | |
| 37 | def command_info(successful_status=(0,), stacklevel=1, **kw): |
| 38 | info = {} |
no test coverage detected