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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user