I have this script, which should start a keep-alive script and Sublime Text 3 under Bash for Windows:
#!/bin/dash
set -e
# Keep alive (in background)
tail -f /dev/null &
pid=$!
echo "tail process id: ${pid}"
echo "Keep-alive process started with Sublime Text 3\nPress SIGINT (CTRL+C) to kill it..."
# Start Sublime Text 3
DISPLAY=localhost:0 /usr/bin/sublime
# http://stackoverflow.com/a/19274804/1442219
trap "kill ${pid}; exit 1" INT
wait
This code generates:
tail process id: 49
Keep-alive process started with Sublime Text 3
Press SIGINT (CTRL+C) to kill it...
tail: cannot determine location of '/dev/null'. reverting to polling: Invalid argument
The whole purpose of this script that I run Sublime Text 3 with GUI with Xorg server under Bash for Windows. I try to make a shortcut to start this script with "C:\Windows\System32\bash.exe" -c "./my-script.sh"
command and Bash for Windows have to run in the background when I use ST3, because otherwise there are dbus
errors (even if you modified /etc/dbus-1/session.conf
)
The problem is: If I press CTRL+C
, tail
process is still presented in the background.
Edit:
I changed the ordering in the script, putted tail
and wait
under everything.
Solved:
Looks like dash
isn't supporting SIGINT
or INT
. Solution is to use bash
and SIGINT
will work as it should.