Hi all,
I'm writing (under linux or windows+cygwin) a java program that needs to run a command (process P1) and read its stdout (which is mostly binary data useful to my program). This is easy to do, and already done.
The problem is that P1 also prints some status informations on stderr, and I would like to spawn a terminal (like xterm) to show it in a user-readable way. Is there any easy method to do so?
I considered the option of just feeding some JTextArea with the output of stderr, but this program makes use of special control characters (in particular erase last line). Unfortunately, I couldn't find any "Terminal (J)Component" freely available.
So the easiest way would be to be able to open an xterm (P2) that shows everything that comes to its stdin in its window, and start a java thread doing in loop err.read(P1) -> in.write(P2) to transfert everything from stderr(P1) to stdin(P2).
Another option would be to be able to launch something like "xterm -e P1_command" and still be able to capture P1 stdout...
Thank you very much for your help!
PS : I would like to remain as much portable as possible, so I'm not sure going into /dev/pts is a good idea