Auto-format content from stdout and stderr if content is empty.
(self)
| 31 | |
| 32 | @model_validator(mode="after") |
| 33 | def format_content(self) -> "BashOutputResult": |
| 34 | """Auto-format content from stdout and stderr if content is empty.""" |
| 35 | output = "" |
| 36 | if self.stdout: |
| 37 | output += self.stdout |
| 38 | if self.stderr: |
| 39 | output += f"\n[stderr]:\n{self.stderr}" |
| 40 | if self.bash_id: |
| 41 | output += f"\n[bash_id]:\n{self.bash_id}" |
| 42 | if self.exit_code: |
| 43 | output += f"\n[exit_code]:\n{self.exit_code}" |
| 44 | |
| 45 | if not output: |
| 46 | output = "(no output)" |
| 47 | |
| 48 | self.content = output |
| 49 | return self |
| 50 | |
| 51 | |
| 52 | class BackgroundShell: |
nothing calls this directly
no outgoing calls
no test coverage detected