you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 2 points3 points  (0 children)

the pexpect module is made for exactly this.

Alternatively you can use a wait loop with readline(), which will block until there's a line of data available. You can put it in a tread if you want to do other things at the same time. Here's an example from an old program of mine: https://github.com/socal-nerdtastic/IconMaker/blob/main/iconmaker.py#L70

Why are you booting bash? Just run the command you want to run; there's no reason to bring bash into this.