Skip to content
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

Disable --tty for subprocess when parent process is non-tty #1306

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

xz-dev
Copy link

@xz-dev xz-dev commented Sep 14, 2023

First, stdin not need --tty option, it only dependent --interactive option. Secendly, when running in subprocess mode, disable --tty option if parent process does not have a tty. This prevents the subprocess incorrectly detecting tty and enabling interactive features like ansible-config init.
For example, if you use ansible-navigator config init -m stdout > config, the subprocess will incorrectly detect tty and waiting 'q' to exit less and cause errors of config. This change avoids that.

More code see at here ansible_navigator. ansible_navigator enable input_fd even if in non-tty mode, It is understandable because they are able to control the input and output based on needs.

First, stdin not need --tty option, it only dependent --interactive option.
Secendly, when running in subprocess mode, disable --tty option if
parent process does not have a tty. This prevents the
subprocess incorrectly detecting tty and enabling interactive
features like `ansible-config init`.
For example, if you use `ansible-navigator config init -m stdout > config`, the subprocess will incorrectly detect tty and waiting 'q' to exit less and cause errors of config. This change avoids that.
@Shrews
Copy link
Contributor

Shrews commented Sep 20, 2023

I kinda have a feeling this might break pexpect and passwords (not sure we have testing mechanisms set up for that). Someone will have to dig into that aspect and do some validation there.

@Shrews
Copy link
Contributor

Shrews commented Sep 22, 2023

I've done some manual testing in various scenarios (pexpect w/ passwords, subprocess in container connecting stdin to the input, etc) and it seems to work as expected. However, I'm not 100% certain I've covered all of the scenarios. This really needs some testing from the Controller team to validate that nothing on their side is affected negatively by this.

@xz-dev
Copy link
Author

xz-dev commented Oct 13, 2023

Is there anything else that needs testing? I'd be happy to continue improving this PR.

Copy link

sonarcloud bot commented Jul 25, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants