Good evening. I'm having issues related to subprocesses.

What I'm trying to do is launch another program that has a command-line mode (Gnucap, in case it matters) as a child process from my Java program, then communicate with it by reading from its standard output and writing to its command line. When I launch the child process, however, I find that when I try to read from the child's standard output, it only reads up until the end of the last complete line of output before the command prompt. After that, when I try to read the next byte from the child's standard output, the read() function blocks forever. Writing anything (including a newline) to the child's standard input at any point in this process has no effect.

I have used Java's built-in Process class, Apache Commons Exec, and ExpectJ. In all three cases, the same problem happens.

What can I do? Thanks for your time.

6 Years
Discussion Span
Last Post by JDCyrus

Also, I'm on Linux. (I should have mentioned this, since I understand that behavior of child process I/O can be OS dependent.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.