rexpect icon indicating copy to clipboard operation
rexpect copied to clipboard

better support for embedded targets, ssh

Open jcaplan opened this issue 3 years ago • 2 comments

spawn_bash assumes you're spawning a new terminal on the same machine running rexpect. I use pexpect to write integration tests for embedded targets and pxssh is really useful. Having the fairly robust ssh login stuff for starters, but also not assuming the login shell is necessarily bash while still providing reliable synchronization and resetting the prompt (i.e. set PS1 but don't try to load .profile or anything)

jcaplan avatar Sep 25 '22 02:09 jcaplan

Hi! Thanks for opening this issue.

Do you have a concrete request here? I am not sure I see one in your message :laughing:

matthiasbeyer avatar Sep 25 '22 07:09 matthiasbeyer

Yeah I think this and #69 are about providing a more "batteries includes" experience for using rexpect to drive integration testing. I split them in two because this one is more about how you connect/open a process, whereas #69 is about providing helpful functions once the process is already opened. so off the top of my head useful features I know I relied on heavily in pexpect that would be nice to match:

  • port over pxssh login function
  • fdpexpect or similar where you can pass an open file descriptor (useful for building serial connection layer)
  • separate out syncing the shell prompt from spawn_bash() into into its own function prompt_sync() that can be easily used with other shells, not just bash. in pexpect replwrap you can override the command to start the shell and it doesn't try to do anything fancy like load the profile or anything.

just looking at the code for spawn_bash() I think it can be simplified a lot by passing bash -l option instead of manually looking for rcfiles etc.

jcaplan avatar Sep 25 '22 14:09 jcaplan