Reputation: 549
I have a makefile that calls
...
@lessc less/mything.less > style.uncompressed.css
can i run a command like "beep" or "paplay ..." when the lessc compiler has errors? If how do i do it?
I am running this in background and have a script checking folder for changes, if something changes this makefile is executed. I don't have a 2nd monitor and i don't want the console to be always on top. So a sound when a error would be great. Maybe someone knows another solution for this.
Upvotes: 1
Views: 426
Reputation: 94849
Make's default action on build failure is to exit with a non-zero exit code. If make terminates with a non-zero exit code, you can make a simple wrapper around it that invokes the sound generation command:
make
if [ $? -ne 0 ]; then
tput bel
aplay <sound to play>.mp3
fi
Upvotes: 3