lib/shell.c: fix invalid command handling

stdin pipe must be emptied when an invalid (too long) command is detected, so
that it can go on working for next incoming chars.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>