fix(sandbox): treat non-zero exit codes as errors instead of relying only on stderr

This commit is contained in:
Eternity
2026-01-26 18:50:22 +08:00
parent f1f887faae
commit 1f615a06ad
3 changed files with 4 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ class CodeNodeConfig(BaseNodeConfig):
description="output variables"
)
code_content: str = Field(
code: str = Field(
default="",
description="code content"
)

View File

@@ -47,7 +47,7 @@ class CodeNode(BaseNode):
result = {}
for output in self.typed_config.output_variables:
value = exec_result.get(output.name)
if not value:
if value is None:
raise RuntimeError(f"Return value {output.name} does not exist")
match output.type:
case VariableType.STRING:
@@ -104,7 +104,7 @@ class CodeNode(BaseNode):
"x-api-key": 'redbear-sandbox'
},
json={
"language": "python3",
"language": self.typed_config.language,
"code": base64.b64encode(final_script.encode("utf-8")).decode("utf-8"),
"options": {
"enable_network": True