scripts/all/gr: only bring the window forward if the command succeeds