I can't figure out how to close a bash shell that was started via Popen. I'm on windows, and trying to automate some ssh stuff. This is much easier to do via the bash shell that comes with git, and so I'm invoking it via Popen in the following manner: 
p = Popen('"my/windows/path/to/bash.exe" | git clone or other commands') 
p.wait() 
The problem is that after bash runs the commands I pipe into it, it doesn't close. It stays open causing my wait to block indefinitely. 
I've tried stringing an "exit" command at the end, but it doesn't work.
p = Popen('"my/windows/path/to/bash.exe" | git clone or other commands && exit') 
p.wait() 
But still, infinite blocking on the wait. After it finishes its task, it just sits at a bash prompt doing nothing. How do I force it to close?
 
     
     
    