@hunyed15/codecgc 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -134,11 +134,12 @@ def _validate_backend_target_paths(target_paths: List[Path]) -> tuple[bool, List
|
|
|
134
134
|
return True, policy_checks, ""
|
|
135
135
|
|
|
136
136
|
|
|
137
|
-
def run_shell_command(cmd: list[str]) -> Generator[str, None, None]:
|
|
137
|
+
def run_shell_command(cmd: list[str], cwd: Optional[Path] = None) -> Generator[str, None, None]:
|
|
138
138
|
"""Execute a command and stream its output line-by-line.
|
|
139
139
|
|
|
140
140
|
Args:
|
|
141
141
|
cmd: Command and arguments as a list (e.g., ["codex", "exec", "prompt"])
|
|
142
|
+
cwd: Optional working directory for the command
|
|
142
143
|
|
|
143
144
|
Yields:
|
|
144
145
|
Output lines from the command
|
|
@@ -157,6 +158,7 @@ def run_shell_command(cmd: list[str]) -> Generator[str, None, None]:
|
|
|
157
158
|
stderr=subprocess.STDOUT,
|
|
158
159
|
universal_newlines=True,
|
|
159
160
|
encoding='utf-8',
|
|
161
|
+
cwd=str(cwd) if cwd else None, # 添加 cwd 参数,确保在正确的工作目录中运行
|
|
160
162
|
)
|
|
161
163
|
|
|
162
164
|
output_queue: queue.Queue[str | None] = queue.Queue()
|
|
@@ -263,7 +265,7 @@ def _execute_codex_session(
|
|
|
263
265
|
err_message = ""
|
|
264
266
|
thread_id: Optional[str] = None
|
|
265
267
|
|
|
266
|
-
for line in run_shell_command(cmd):
|
|
268
|
+
for line in run_shell_command(cmd, cwd=cd):
|
|
267
269
|
try:
|
|
268
270
|
line_dict = json.loads(line.strip())
|
|
269
271
|
all_messages.append(line_dict)
|