perf(environments): skip stdin staging for empty payloads

execute() can pass stdin_data="" (e.g. write_file of empty content). The
`is not None` guard then paid an upload (plus chmod on Daytona) and a
longer shell command just to feed zero bytes. Base heredoc mode skipped
empty stdin, and neither SDK exec attaches a stdin, so treating "" as no
stdin gives exactly the base command (checked: identical argv, no upload).
This commit is contained in:
kshitijk4poor
2026-09-26 22:55:06 +05:30
committed by kshitij
parent e4f51c654e
commit 8f5b5cd88b
2 changed files with 2 additions and 2 deletions

View File

@@ -162,7 +162,7 @@ class DaytonaEnvironment(BaseEnvironment):
def exec_fn() -> tuple[str, int]:
command = cmd_string
if stdin_data is not None:
if stdin_data: # empty stdin == no stdin, as on base (heredoc skipped it)
with lock:
if state["cancelled"]:
return ("", 130)

View File

@@ -365,7 +365,7 @@ class VercelSandboxEnvironment(BaseEnvironment):
def exec_fn() -> tuple[str, int]:
command = cmd_string
if stdin_data is not None:
if stdin_data: # empty stdin == no stdin, as on base (heredoc skipped it)
with lock:
if state["cancelled"]:
return ("", 130)