INNER CODE UNIT · Python
launch
WMAL/kodachios · Kodachi-OS-10-stable/open/dock/lib/kodachi_direct.py:852
def launch(key, parameters=None, stdin_values=None, survival_seconds=0.75,
contract=None):
"""Launch exactly one direct binding and prove it survives the handoff."""
direct = contract or registry()
allow_handoff = direct.launch_allows_handoff(key)
bindings = direct.bindings(key)
if len(bindings) != 1:
raise DirectContractError("launch operations must have exactly one direct binding")
binding = bindings[0]
argv = direct.argv_for(binding, parameters)
if stdin_values not in (None, b"", ""):
raise DirectContractError("launch operations cannot own confidential stdin")
input_text = _stdin_for(binding, None)
try:
proc = subprocess.Popen(
argv,
stdin=subprocess.PIPE if input_text is not None else subprocess.DEVNULL,
stdout=subprocess.DEVNULL,