mirror of
https://github.com/langgenius/dify.git
synced 2026-02-22 14:01:50 -05:00
fix(command-node): improve error reporting in command execution
- Updated error handling to provide detailed stderr output when a command fails. - Streamlined working directory and command rendering by combining operations into single lines.
This commit is contained in:
@@ -64,11 +64,8 @@ class CommandNode(Node[CommandNodeData]):
|
||||
error_type="SandboxNotInitializedError",
|
||||
)
|
||||
|
||||
working_directory = (self.node_data.working_directory or "").strip()
|
||||
raw_command = (self.node_data.command or "").strip()
|
||||
|
||||
working_directory = self._render_template(working_directory).strip()
|
||||
raw_command = self._render_template(raw_command).strip()
|
||||
working_directory = self._render_template((self.node_data.working_directory or "").strip())
|
||||
raw_command = self._render_template(self.node_data.command or "")
|
||||
|
||||
working_directory = working_directory or None
|
||||
|
||||
@@ -118,7 +115,7 @@ class CommandNode(Node[CommandNodeData]):
|
||||
status=WorkflowNodeExecutionStatus.FAILED,
|
||||
outputs=outputs,
|
||||
process_data=process_data,
|
||||
error=f"Command exited with code {result.exit_code}",
|
||||
error=f"{result.stderr.decode('utf-8', errors='replace')}\n\nCommand exited with code {result.exit_code}",
|
||||
error_type=CommandExecutionError.__name__,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user