Execute command and return structured output with exit code. Args: command: Shell command to execute pane: Target pane identifier (session:window.pane, %id, or index) timeout: Maximum seconds to wait (default: 30)
(self, command: str, pane: Optional[str] = None, timeout: int = 30)
| 823 | return content |
| 824 | |
| 825 | def execute(self, command: str, pane: Optional[str] = None, timeout: int = 30): |
| 826 | """Execute command and return structured output with exit code. |
| 827 | |
| 828 | Args: |
| 829 | command: Shell command to execute |
| 830 | pane: Target pane identifier (session:window.pane, %id, or index) |
| 831 | timeout: Maximum seconds to wait (default: 30) |
| 832 | """ |
| 833 | if self.mode == 'local': |
| 834 | # Local mode - resolve pane identifier |
| 835 | if pane: |
| 836 | resolved_pane = self.controller.resolve_pane_identifier(pane) |
| 837 | if not resolved_pane: |
| 838 | print(f"Could not resolve pane identifier: {pane}") |
| 839 | return |
| 840 | else: |
| 841 | resolved_pane = None |
| 842 | |
| 843 | result = self.controller.execute(command, pane_id=resolved_pane, timeout=timeout) |
| 844 | else: |
| 845 | # Remote mode - pass pane directly |
| 846 | result = self.controller.execute(command, pane_id=pane, timeout=timeout) |
| 847 | |
| 848 | # Print JSON for easy parsing |
| 849 | print(json.dumps(result, indent=2)) |
| 850 | return result |
| 851 | |
| 852 | def interrupt(self, pane: Optional[str] = None): |
| 853 | """Send Ctrl+C to a pane.""" |
no test coverage detected