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

sh not displaying interactive prompts while using gentoo portage tools #251

Closed
Triquetra opened this issue May 3, 2015 · 4 comments
Closed

Comments

@Triquetra
Copy link

sh.emerge("-uDN", "--ask=y", "@world", _tty_in=True, _out=sys.stdout) correctly invokes emerge with output to the shell, but interactive elements (like dependency calculation eye candy or confirmation prompt) are not displayed, and cannot be interacted with. That is, even if a "y" or "n" is entered at the time/place where the confirmation prompt should appear, nothing happens.

subprocess.call(["emerge", "-uDN", "--ask=y", "@world"], stdout=sys.stdout) seems to work identically to running emerge directly in the shell

Similarly, sh.dispatch_conf(_tty_in=True, _out=sys.stdout) fails to print the input prompt or accept input for the diff/merge of config files (even though the diff itself is displayed). However, subprocess.call(["dispatch-conf"], stdout=sys.stdout) seems to work identically to running dispatch-conf in a shell.

Both emerge and dispatch-conf are part of the gentoo portage package manager.

I've tried adding _tty_out=False and/or _in=sys.stdin as arguments to the sh calls without improvement, though not without effect. Is there something I'm missing to get these programs to work with sh?

@amoffat
Copy link
Owner

amoffat commented May 4, 2015

The feature you're describing is foreground mode but unfortunately it has not yet been built. There is no way to use interactive scripts reliably with sh yet.

@Triquetra
Copy link
Author

Yes, that sounds like what I'm looking for. I see the thread you linked to is 2.5 years old. Is there an ETA for this feature? Pexpect looks like a great candidate to borrow code from.

@amoffat
Copy link
Owner

amoffat commented May 4, 2015

I think the route I will end up taking is this comment. No ETA on it yet, but I will review and merge it if someone else gets to it before I do.

@amoffat amoffat added the 1.2 label Nov 6, 2015
@amoffat amoffat modified the milestone: 1.2 Oct 25, 2016
@amoffat amoffat removed the 1.2 label Oct 25, 2016
@amoffat
Copy link
Owner

amoffat commented Oct 25, 2016

A very lightweight foreground mode via _fg=True is implemented in the release-1.2 branch

@amoffat amoffat closed this as completed Oct 25, 2016
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

No branches or pull requests

2 participants