private void handleProjectInput()

in common/src/main/java/org/mvndaemon/mvnd/common/logging/TerminalInputHandler.java [129:152]


    private void handleProjectInput(String projectId, int bytesToRead) throws IOException {
        if (daemonReceive == null) {
            return;
        }
        char[] buf = bytesToRead > 0 ? new char[bytesToRead] : new char[8192];
        int idx = 0;
        int timeout = 10; // Initial timeout for first read

        while ((bytesToRead < 0 || idx < bytesToRead) && idx < buf.length) {
            int c = terminal.reader().read(timeout);
            if (c < 0) {
                // End of stream reached
                daemonReceive.accept(Message.inputEof());
                break;
            }
            buf[idx++] = (char) c;
            timeout = idx > 0 ? 1 : 10; // Shorter timeout after first char
        }

        if (idx > 0) {
            String data = String.valueOf(buf, 0, idx);
            daemonReceive.accept(Message.inputResponse(data));
        }
    }