Set up the execution environment. Args: cwd: Working directory to change to Raises: TargetError: If unable to set up environment
(cwd: str)
| 107 | |
| 108 | |
| 109 | def _setup_environment(cwd: str) -> None: |
| 110 | """ |
| 111 | Set up the execution environment. |
| 112 | |
| 113 | Args: |
| 114 | cwd: Working directory to change to |
| 115 | |
| 116 | Raises: |
| 117 | TargetError: If unable to set up environment |
| 118 | """ |
| 119 | try: |
| 120 | os.chdir(cwd) |
| 121 | except OSError as e: |
| 122 | raise TargetError(f"Failed to change to directory {cwd}: {e}") from e |
| 123 | |
| 124 | # Add current directory to sys.path if not present (for module imports) |
| 125 | if cwd not in sys.path: |
| 126 | sys.path.insert(0, cwd) |
| 127 | |
| 128 | |
| 129 | def _execute_module(module_name: str, module_args: List[str]) -> None: |
no test coverage detected
searching dependent graphs…