2

On Windows 8.1.

I have written a simple .sh script to start up my dev environment. I know, I can use Windows native batch script (and it works fine, has no given problem), but I prefer Git Bash. The problem is that every Git Bash window opened by my script is closed on Ctrl+C. And I don't want them to get closed but only exit running processes.

Here is my script. It opens four Git Bash windows and starts processes within them. And when I strike Ctrl+C in one of those four windows, the window just closes. Kills the process (except nginx; nginx continues working) and closes. And I only want to stop the process, not terminate the window:

#!/bin/bash

cd /c/nginx
start sh.exe --login -i -c "nginx"

cd /c/Users/user/app
start sh.exe --login -i -c "NODE_ENV='development' nodemon"

start sh.exe --login -i -c "NODE_ENV='development' gulp mytask"

start sh.exe --login -i -c "NODE_ENV='development' compass watch"

How to do it?

Green
  • 28,742
  • 61
  • 158
  • 247
  • Have a look [here](http://stackoverflow.com/questions/673278/cygwin-run-script-silenty-from-run-command). You are fighting against the standard behavior of Windows, so the solution is non trivial. – Tim Biegeleisen Jan 18 '16 at 14:04

1 Answers1

0

If you use a wrapper like Console2 or ConsoleZ around git bash with it's shell pointed to "C:\Program Files\Git\usr\bin\sh.exe" --login -i or "C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files\Git\usr\bin\sh.exe" --login -i"" it works fine. I'm not sure how to do it without having that wrapper, but it's pretty cool to use one anyway so you could try it out!