(command)
| 22 | |
| 23 | |
| 24 | def run_cmd(command): |
| 25 | if command is not None: |
| 26 | try: |
| 27 | p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 28 | stdout, stderr = p.communicate() |
| 29 | return_code = p.returncode |
| 30 | |
| 31 | except OSError as e: |
| 32 | stdout = "Check your command type" |
| 33 | stderr = "Exception occurred: %s" % e |
| 34 | return_code = 1 |
| 35 | |
| 36 | finally: |
| 37 | print('%s&&' % stdout.decode().strip()) |
| 38 | print('%s&&' % stderr.decode().strip()) |
| 39 | print('%s' % return_code) |
| 40 | |
| 41 | |
| 42 | def get_command(): |
no test coverage detected