1

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.

Ashish
  • 341
  • 2
  • 7
  • 17
  • You can solve this problem like this as it mentioned in here; [example](https://stackoverflow.com/questions/5711084/java-runtime-getruntime-getting-output-from-executing-a-command-line-program) – Bu_A Jan 24 '22 at 11:11
  • Thanks for quick response but none of these are working when integrating with Spring Boot CommandLineRunner. The program gets stuck or does not prompt for any input. – Ashish Jan 24 '22 at 12:17

0 Answers0