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

Support for redirected stdin and stdout #52

Closed
tstat opened this issue Jul 31, 2014 · 3 comments
Closed

Support for redirected stdin and stdout #52

tstat opened this issue Jul 31, 2014 · 3 comments

Comments

@tstat
Copy link

tstat commented Jul 31, 2014

I see that mkVty calls inputForCurrentTerminal and outputForCurrentTerminal which open stdin and stdout. For my own use I made two new functions inputForNewTerminal and outputForNewTerminal which both open /dev/tty instead of stdin and stdout. I then copied intMkVty and made a slightly modified mkVty that calls the 'NewTerminal' functions instead of the 'CurrentTerminal' ones. This allows for redirecting stdin and stdout while still maintaining interactivity. It doesn't seem to have any other effects on vty.

My questions are: am I mistaken in my method to achieve this behavior; does vty support programs that may redirect stdin and stdout without a stub and I was just going about it incorrectly? If not, is supporting this type of behavior desirable?

@coreyoconnor
Copy link
Contributor

You are not mistaken. mkVty did offer no configuration of the terminal file descriptor. The methods for creating Output and Input structures that used specific file descriptors were not used by mkVty.

I've pushed a change that should resolve this: ddd61dd

This adds input and output file descriptors as optional properties of the Config structure. For your application a Config structure with inputFd and outputFd set appropriately can be passed to mkVty to achieve the desired effect.

I'm still testing this change, but plan on releasing once testing completes. Once my testing is complete I'll resolve this issue.

Thanks for the feedback! This was a good opportunity to resolve a historical oddity in vty.

@tstat
Copy link
Author

tstat commented Aug 10, 2014

Thanks Corey that commit looks great. I appreciate you taking the time to read and respond to my issue. I look forward to more happy times with Vty!

@tstat tstat closed this as completed Aug 10, 2014
@coreyoconnor
Copy link
Contributor

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