Deal with sudo/interactive input in StartProcess
There is a example in document page of StartProcess
command = "";
process = StartProcess[$SystemShell];
Pause[.1];
processString = ReadString[process, EndOfBuffer];
Column[{
Pane[Dynamic[processString],
ImageSize -> {800, 400}, Scrollbars -> True, ScrollPosition -> {-1, -1}],
InputField[Dynamic[command], String],
Button["Go!",
WriteLine[process, command];
Pause[.1];
processString =processString <> ReadString[process, EndOfBuffer];]
}]
This is useful, but not enought by now.
How can I do a cmd which need typing password? for example sudo?
For example, one of my purpose is to use this to batch check my hbase, and I need switch to root with ssh, and ssh to the server.
su root, if I do this in the Terminal, I need to type the password
Anyone extented this example of StartProcess?