I am developing an application that should run the command as root, so I use:
process = Runtime.getRuntime().exec("su");
Then I start the te process with
os = new DataOutputStream(process.getOutputStream());
os.writeBytes("tcpdump\n");
When I need to complete the process os.writeBytes("exit\n");, it does not work, but process.waitFor();receives a lock and the process does not end. I need to send Control-C to a process to stop it, but I don't know how to do it.
Thank.
Jimix source
share