• Post Reply Bookmark Topic Watch Topic
  • New Topic

java console input doesn't stop linux "rpm" execution  RSS feed

 
Andrey Galimshyn
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, all,
my Java program is called when installing rpm archive (program inside), OS - Fedora 10. When it's time to get input from console, execution doesn't stop, as a result - in program error happens.


//Allows to read variables from console without type cast from string to int for example
private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

...
//This code doesn't stop rpm execution in Fedora

String commandName = this.in.readLine();


what can I do?

Thanks in advance,
Andrey
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Try excecuting your shell script as backgroud process.

 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most likely there's a newline waiting on System.in, which the Java program reads and returns as soon as it hits the readline(). It's possible that it just comes from you pressing "return" twice, or running the script from a terminal that's sending extra newlines, or something like that. But can we see the relevant part of the shell script?
 
Andrey Galimshyn
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest Friedman-Hill wrote:Most likely there's a newline waiting on System.in, which the Java program reads and returns as soon as it hits the readline(). It's possible that it just comes from you pressing "return" twice, or running the script from a terminal that's sending extra newlines, or something like that. But can we see the relevant part of the shell script?


Sorry, it's not a script problem that's rpm command starting from the script:

rpm --install --hash --prefix=blablabla -v some_rpm_that_starts_and_crashes.rpm
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!