This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Process and his OutputStream

 
Stefan Litzel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

i hope you can help me with my little problem.

I want to execute a cmd command with the ProcessBuilder, but for some reason writing information to the stdin of the console doesnt work properly.

I tried the following:



The output on the console is as expected the question for the admin password. But when i try to write the pass to the console nothing happens.


Best wishes

Stefan Litzel
 
Joe Ess
Bartender
Pie
Posts: 9258
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Litzel wrote:But when i try to write the pass to the console nothing happens.


Is your code even getting that far? You are reading from the process' output stream until EOF (indicated by a null). I wouldn't expect that to happen until the process terminates. Try printing to the screen between your read and write.
 
Stefan Litzel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also tried it without the InputStream of the cmd program. Still the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic