Skip to content

Instantly share code, notes, and snippets.

@JBirdVegas
Created March 5, 2013 21:59
Show Gist options
  • Save JBirdVegas/5094720 to your computer and use it in GitHub Desktop.
Save JBirdVegas/5094720 to your computer and use it in GitHub Desktop.
CMDProcessor returns
package com.aokp.romcontrol.fragments.team;
import android.util.Log;
import com.aokp.romcontrol.util.CMDProcessor;
import com.aokp.romcontrol.util.CommandResult;
import com.aokp.romcontrol.util.Executable;
import com.aokp.romcontrol.util.Helpers;
/**
* Created with IntelliJ IDEA.
* User: jbird
* Date: 3/5/13
* Time: 4:58 PM
* To change this template use File | Settings | File Templates.
*/
public class test {
private String cats(String path) {
CMDProcessor shell = new CMDProcessor();
Helpers.getMount("rw");
Executable cat = new Executable("cat " + path);
shell.setLogcatDebugging(true); // show debugging in logcat
CommandResult result = shell.su.runWaitFor(cat);
// you can get all kinds of info from the CommandResult returned
Log.d("foo", "bar results" + result.toString());
Helpers.getMount("ro");
return result.getStdout();
}
private boolean scriptIt(String value) {
CMDProcessor shell = new CMDProcessor();
Helpers.getMount("rw");
// all commands are sent on the same shell so execution times
// are very quick
Executable apply = new Executable(
"echo " + value + " > /system/file",
"echo " + value + " >> /system/file",
"echo " + value + " >> /system/file");
try {
return shell.setLogcatDebugging(true)
.su.runWaitFor(apply).success();
} finally {
Helpers.getMount("ro");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment