cmd.c: properly handle shell command error.