1

I have been looking at a thread java input.readLine hangs after starting a powershell script

which is exactly what I have done, but in JDK 1.6, we do not have ProcessBuilder - redirectOutput and Redirect to.

So is there any way to solve the waiting/hanging?

2 Answers 2

1

I believe real problem is the way how PowerShell handles STDIN stream while running in Java executed console environment. I use this trick to run batch scripts with powershell task or direct powershell script execution. Add InputFormat none to avoid STDIN hangs.

powershell -NoLogo -Noninteractive -InputFormat none -Command "%cmd%"
Sign up to request clarification or add additional context in comments.

Comments

0

I recommend checking out the Apache Ant library available at http://ant.apache.org/

I've used the 'Exec' task to run git.exe and capture its output. I modeled the code after the second option on http://groovy.codehaus.org/Executing+External+Processes+From+Groovy

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.