Return failure code on failure; DM-1027

OK, replaced python test with inline shell as per KT's request and stopped messing with PRINT_CMD_LINE_FUNC

Good to merge?