-
Notifications
You must be signed in to change notification settings - Fork 31
modified pdd sync that shows stdout/error message at the bottom #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,9 @@ | |||||
| import subprocess | ||||||
| import re | ||||||
| import os | ||||||
| import sys | ||||||
| import io | ||||||
| from contextlib import contextmanager | ||||||
| from pathlib import Path | ||||||
| from typing import Dict, Any, Optional, List | ||||||
| from dataclasses import asdict | ||||||
|
|
@@ -228,6 +231,43 @@ def _execute_tests_and_create_run_report(test_file: Path, basename: str, languag | |||||
| save_run_report(asdict(report), basename, language) | ||||||
| return report | ||||||
|
|
||||||
| # --- Output Capture Helper --- | ||||||
|
|
||||||
| @contextmanager | ||||||
| def capture_output(): | ||||||
| """Context manager to capture stdout and stderr.""" | ||||||
| old_stdout = sys.stdout | ||||||
| old_stderr = sys.stderr | ||||||
| stdout_buffer = io.StringIO() | ||||||
| stderr_buffer = io.StringIO() | ||||||
|
|
||||||
| try: | ||||||
| sys.stdout = stdout_buffer | ||||||
| sys.stderr = stderr_buffer | ||||||
| yield stdout_buffer, stderr_buffer | ||||||
| finally: | ||||||
| sys.stdout = old_stdout | ||||||
| sys.stderr = old_stderr | ||||||
|
|
||||||
| def call_with_capture(func, quiet=False, *args, **kwargs): | ||||||
| """Call a function and capture its output, returning (result, captured_output).""" | ||||||
| captured_output = [] | ||||||
|
|
||||||
| if not quiet: | ||||||
| with capture_output() as (stdout_buf, stderr_buf): | ||||||
| result = func(*args, **kwargs) | ||||||
| stdout_content = stdout_buf.getvalue() | ||||||
| stderr_content = stderr_buf.getvalue() | ||||||
| if stdout_content or stderr_content: | ||||||
| if stdout_content: | ||||||
| captured_output.append(f"STDOUT:\n{stdout_content}") | ||||||
| if stderr_content: | ||||||
| captured_output.append(f"STDERR:\n{stderr_content}") | ||||||
| else: | ||||||
| result = func(*args, **kwargs) | ||||||
|
|
||||||
| return result, captured_output | ||||||
|
|
||||||
| # --- Helper for Click Context --- | ||||||
|
|
||||||
| def _create_mock_context(**kwargs) -> click.Context: | ||||||
|
|
@@ -662,6 +702,7 @@ def sync_orchestration( | |||||
|
|
||||||
| result = {} | ||||||
| success = False | ||||||
| captured_output = [] | ||||||
| start_time = time.time() # Track execution time | ||||||
|
|
||||||
| # --- Execute Operation --- | ||||||
|
|
@@ -673,14 +714,17 @@ def sync_orchestration( | |||||
| # Read original prompt content to compare later | ||||||
| original_content = pdd_files['prompt'].read_text(encoding='utf-8') | ||||||
|
|
||||||
| result = auto_deps_main( | ||||||
| ctx, | ||||||
| prompt_file=str(pdd_files['prompt']), | ||||||
| result, operation_output = call_with_capture( | ||||||
| auto_deps_main, | ||||||
| quiet, | ||||||
|
||||||
| quiet, | |
| quiet=quiet, |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as with auto_deps_main - quiet should be passed as a keyword argument: call_with_capture(code_generator_main, quiet=quiet, ctx, ...)
| quiet, | |
| quiet=quiet, |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as with previous operations - quiet should be passed as a keyword argument: call_with_capture(context_generator_main, quiet=quiet, ctx, ...)
| quiet, | |
| quiet=quiet, |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as with previous operations - quiet should be passed as a keyword argument: call_with_capture(crash_main, quiet=quiet, ctx, ...)
| quiet, | |
| quiet=quiet, |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as with previous operations - quiet should be passed as a keyword argument: call_with_capture(cmd_test_main, quiet=quiet, ctx, ...)
| quiet, | |
| quiet=quiet, |
Copilot
AI
Oct 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as with previous operations - quiet should be passed as a keyword argument: call_with_capture(fix_main, quiet=quiet, ctx, ...)
| quiet, | |
| quiet=quiet, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
quietparameter should be the first positional parameter afterfuncto follow Python conventions for boolean flags in function signatures.