I am trying to open Git Bash shell(C:\Program Files\Git\git-bash.exe) using a python script and then run a shell script(for example, basicSc.sh) in git bash shell. I am running the python script in Windows. How can I do that successfully? Also how can I know the *.sh script is completed from the python script? How can I pass some parameters for the *.sh script from the python script? I am running python 3.6.3.
Python script (running from windows command prompt):
import subprocess
p = subprocess.Popen
(
"C:\Program Files\Git\git-bash.exe --l -- C:/Users/userName/Documents/dev/basicSc.sh",
bufsize=-1,
executable=None,
stdin=None,
stdout=None,
stderr=None,
preexec_fn=None,
close_fds=True,
shell=False,
cwd="C:/Users/userName/Documents/dev",
)
Alternatively, if I do the following I can run the *.sh script manually. I am trying to fully automate this. If this is the only possible solution, how do I communicate end of the *.sh script to the python script?
import subprocess
p = subprocess.Popen("C:\Program Files\Git\git-bash.exe",
bufsize=-1,
executable=None,
stdin=None,
stdout=None,
stderr=None,
preexec_fn=None,
close_fds=True,
shell=False,
cwd="C:/Users/userName/Documents/dev",
)