Skip to content

Allow for disabling pseudo-terminals #147

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

Merged
merged 1 commit into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
***Added:***

- No longer build pre-configured Python distributions for release builds
- The top-level `--interactive` flag now disables the use of pseudo-terminals for subprocesses

***Fixed:***

Expand Down
1 change: 1 addition & 0 deletions src/dda/cli/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, *, config: TerminalConfig, enable_color: bool | None, interac
# Force consistent output for test assertions
self.testing = "DDA_SELF_TESTING" in os.environ

self.force_interactive = interactive is True
self.console = Console(
force_terminal=enable_color,
force_interactive=interactive,
Expand Down
13 changes: 13 additions & 0 deletions src/dda/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ def __run(
check: bool,
capture: bool,
) -> tuple[int, str]:
if self.__app.force_interactive:
import subprocess

kwargs: dict[str, Any] = {"env": env, "cwd": cwd}
if capture:
kwargs["encoding"] = encoding
kwargs["stdout"] = subprocess.PIPE
kwargs["stderr"] = subprocess.STDOUT

cmd, kwargs = self.__sanitize_arguments(command, **kwargs)
process = subprocess.run(cmd, **kwargs) # noqa: PLW1510
return process.returncode, process.stdout if capture else ""

import tempfile
import threading

Expand Down