java - How do you write to a Unix terminal from a cmd session created by Runtime.exec? -


i have cmdproc object in java uses runtime.exec-created session , handles stdin, stdout , error streams. works fine on linux, aix , windows. can send os commands , process results, including responding prompts.

however, when send "su" command expects input terminal, not stdin response its' prompt ignored.

any idea how write "appears" have come terminal?

thanks again nidhoegger. answer seems using send/expect. mean specific installation on box - hoping avoid - can create expect script on fly, store in /tmp , execute it, passing de-crypted password parameter. delete script again. working perhaps can find time dig send/expect source code (in tcl) , see if there terminal handling can ported java. efforts.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -