less.ruby icon indicating copy to clipboard operation
less.ruby copied to clipboard

lessc --watch exits on parse error when run non-interactively

Open guns opened this issue 16 years ago • 0 comments

I sent this as a pull request, but I thought I should officially log it as an issue. It's minor, but may be helpful to others who have a similar workflow:

lessc --watch dies on compile errors when it is run in the background:

$ lessc -w foo.less &>/dev/null & # => aborts on parse error

This happens because the main watch loop expects input from $stdin after an error occurs. When not attached to a terminal, $stdin.gets receives an EOF and exits prematurely.

The following patch branch refactors the Less::Command#run! loop to always update the destination timestamp. This allows the process to run without needing any input from the user; if there's an error, just save the file again; lessc will attempt to reparse the source.

http://github.com/guns/less/tree/robust-watch

(updated 12 april 2010: much cleaner patch)

guns avatar Nov 19 '09 10:11 guns