'Executing User Input Commands from Spring Boot

I want to execute a set of Maven commands in Command Prompt (Windows or Linux), one after another. Some of the commands will take an input from user.

I want this to be run using Spring boot. I am using following

    Process process = builder.start();
    MyExecutor executor = 
      new MyExecutor(process.getInputStream(), System.out::println);
    Executors.newSingleThreadExecutor().submit(streamGobbler);      
    exitCode = process.waitFor();` 

This code runs well and able to execute commands in bash/cmd. But it does not prompt the input screen. However the bash/cmd script prompts.

Any suggestion would be helpful here.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source