Losing Input Key Presses When Running With gradle run

When running Gradle applications with ‘gradle run’, I seem to lose every other character of input I write. Is anyone else experiencing this and how can I work around it?

How to reproduce:

  1. Create a new Java application with ‘gradle init’.
  2. Change the generated Java app code to:
public class App {
  public static void main(String[] args) {
    int counter = 0;
    while (true) {
      System.out.println("test " + (counter++));
  1. Run the application with ‘gradle run | less’.

You’d expect that you would be able to scroll down the generated lines by pressing enter or space. Instead, Gradle seems to eat every other character I write. So, to get less to move one row down, I’ll have to hit enter twice and so on.

This is happening on macOS Big Sur (11.4) running Gradle 7.2. The terminal is the default osx Terminal running zsh.