I'm guessing that the problem is simply that your lessc is not short-lived. It's reading from its stdin, which you never close.
How would lessc behave in a terminal if you had it reading from stdin, typed some input at it, then simply waited (never signalling end of input)? That's what your program is doing.