(command, *args)
| 16 | |
| 17 | |
| 18 | def execute_command_blocking(command, *args): |
| 19 | expanded_args = [] |
| 20 | for a in args: |
| 21 | expanded_args.append(a) |
| 22 | # expanded_args += a |
| 23 | try: |
| 24 | sp = subprocess.Popen([command, expanded_args], shell=True, |
| 25 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 26 | out, err = sp.communicate() |
| 27 | if out: |
| 28 | print(out.decode("utf-8")) |
| 29 | if err: |
| 30 | print(err.decode("utf-8")) |
| 31 | except: |
| 32 | out = '' |
| 33 | return out |
| 34 | |
| 35 | # Executes command and immediately returns. Will not see anything the script outputs |
| 36 |