MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / execute_command_blocking

Function execute_command_blocking

DemoPrograms/Demo_Script_Launcher.py:18–33  ·  view source on GitHub ↗
(command, *args)

Source from the content-addressed store, hash-verified

16
17
18def 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

Callers 1

Launcher2Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected