| 14 | #------------------------------------------------------------------------------ |
| 15 | |
| 16 | def runCmd(cmd, data=None): |
| 17 | if input is None: |
| 18 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 19 | stdout, stderr = p.communicate() |
| 20 | else: |
| 21 | p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 22 | stdout, stderr = p.communicate(input=data) |
| 23 | |
| 24 | return stdout.decode('utf-8'), stderr.decode('utf-8'), p.returncode |
| 25 | #------------------------------------------------------------------------------ |
| 26 | |
| 27 | def main(): |