hello everyone. i am trying to run the sudo -i command in my mac.
here is the code
in the beginning of the code p is the object of the Process class.
this code is in a function and i cal this function twice, the first time is to run the sudo -i command and the second one for entering the password,
the problem is when i enter the sudo -i command no output comes out. but for any other command the output comes out just fine.
if any one has any ideas i would be grateful
best regards
hsn
here is the code
Code:
String s = null; try { p = Runtime.getRuntime().exec(str); stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command //System.out.println("Here is the standard output of the command:\n"); /*while ((s = stdInput.readLine()) != null) { System.out.println(s); } // read any errors from the attempted command //System.out.println("Here is the standard error of the command (if any):\n"); while ((s = stdError.readLine()) != null) { System.out.println(s); } */ //System.exit(0); } catch (IOException e) { System.out.println("exception happened - here's what I know: "); e.printStackTrace(); System.exit(-1); } }
this code is in a function and i cal this function twice, the first time is to run the sudo -i command and the second one for entering the password,
the problem is when i enter the sudo -i command no output comes out. but for any other command the output comes out just fine.
if any one has any ideas i would be grateful
best regards
hsn
Comment