diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c
index ee080b62843eaa0811fb9fcc630c4010f12baa37..f4f106df76a4107c2c6d5430c225c29e40736297 100644
--- a/src/scontrol/scontrol.c
+++ b/src/scontrol/scontrol.c
@@ -217,16 +217,15 @@ main (int argc, char *argv[])
 		error_code = _get_command (&input_field_count, input_fields);
 
 	while (error_code == SLURM_SUCCESS) {
-		if (exit_flag) {	/* EOF */
-			putchar('\n');
-			break;
-		}
-
 		error_code = _process_command (input_field_count,
 					       input_fields);
 		if (error_code || exit_flag)
 			break;
 		error_code = _get_command (&input_field_count, input_fields);
+		if (exit_flag) {	/* EOF */
+			putchar('\n');
+			break;
+		}
 	}
 	if (clusters)
 		list_destroy(clusters);