-
Notifications
You must be signed in to change notification settings - Fork 136
Is there a Interact() interface #5
Comments
Hey Kenny. No there's no interact() interface in this expect , purely b/c we haven't had the usecase for it. You'd like for a human to interact with the process until pressing some keycombo to give the control back to the expect batch? |
Hi, Use case as below, |
Hey Kenny .. Late response , pretty hectic atm. I'll sort out a design next week , feel free to add anything here that you'd like for the interact interface. |
Or a pull request .. :) |
Ok have put some thought/code into this .. My thinking is to expose Reader and Writer interfaces from expecter .. With this you can just read/write the Expecter.. So doing an interact thing to your current terminal should be as simple as. e := Spawn(bla) Still working on implementing this in a proper way , some changes to the Expect logic needed here. |
Hi Skalle, If providing API as pexpect, the use case will be as below |
Still some stuff to work out , code so far is in the intent branch. With this change the Expecter implements the Reader/Writer interface for you to interact with. I think this'd make it more powerful and versatile than just adding the Interact function , this way you can tie the I/O to whatever you want eg. a PTY from term or some remote network pipe. Gives you full control of how to end the interaction too , write a phrase or type some mysterious character. We can still add the Interact function on top of the Reader/Writer as a convinence thing just using the os.Stdin/os.Stdout for I/O. Status is still work-in-progress. Off for some rest and weekend now , will mess around more with this next week. |
sounds great |
Sorry for the long delay here .. Perf time at work so very limited time for this. Haven't forgotten about this, just need to find some time. |
Incase someone want to have a stab at this one, feel free.. Fine to use some of the code I wrote to handle this or start from scratch. |
Hey, Have you figured it out how to add an interactive session? |
I'm also working on a similar project and I also need an interactive session after logging in through ssh using expect |
Hey vegeta1509 . Sorry but this has been put on the backburner .. I did write an interact version earlier when the bug was filed but it didnt' fit very well into the library. Added complexity and was more of a hack. Could you describe what you need here a bit further? |
When we run command
I've tried creating the session in main function and then passed session instead of client in the function. And after running my commands using expect I tried changing the I/O pipes so that it can work as interactive PTY.
But it's not working properly, the server gives output sometimes, sometimes it doesn't. Many times it doesn't take input properly. So I think the I/O pipes are not transmitting data properly. If you could help me in figuring out correct way to attach these I/O pipes then that would be great help. |
Anyone got a solution for interact in goexpect ? |
Hi,
How to gives control of the child process to the interactive user (the human at the keyboard) like the interact() method in pexpect?
The text was updated successfully, but these errors were encountered: