Hi,
I am trying to create a simple Automator droplet that will take the style.less
file dropped into it and run the following LESS command on it:
$ LESSC {DROPPED_FILE} --watch
which will monitor the file I have dropped in for any changes and will then automatically update the outputted style.css
FYI: I am using LESS to have dynamically written CSS files. More info is here.
The basic droplet works great.
- The dropped file is passed into a variable; For this purpose:
{MY_VAR}
. - I run a shell script in the
/usr/bin/ruby
shell as followssystem("lessc {MY_VAR} --watch &")
this works great however I want the --watch to be stopped upon quitting the automator app.
The LESS documentation says to press the CTRL-C shortcut while in the command line shell to abort the script.
But since I am not inside the terminal window (command is being passed in the background) I don't know how to abort the script.
Even after the automator.app has been closed the style.less
file is still being watched for changes and the correspondingly generated style.css
is still being rewritten.
So basically I need to pass the abort command on exit of the .app.
I have generated a simple pop up that on click will close the app after passing another command to the terminal shell.
This is the part where all my tries have been unsuccessful to stop the script.
Is there a command line function that acts the same as pressing the CTRL-C command? How would I pass this the best to the shell?
Thanks for reading,
Jannis