Shell.SU.Run does not return
Closed this issue · 3 comments
aelmahmoudy commented
I am using libsuperuser, by importing the following:
import eu.chainfire.libsuperuser.Application;
import eu.chainfire.libsuperuser.Shell;
In the class I got the following method:
private List<String> suRun(String format, Object... args) {
String binDir = mAppContext.getFilesDir() + "/bin/";
String command = binDir + String.format(format, args);
return Shell.SU.run(command);
}
and in another method, I call it as follows:
List<String> result = suRun("cs close %s", getVolumePath());
the command does run, yet it doesn't seem to return, here's the relevant logcat output:
D/libsuperuser( 9783): [libsuperuser][C][SU%] START
D/libsuperuser( 9783): [libsuperuser][C][SU+] /data/data/me.opsec.darkmatter/files/bin/cs close /extSdCard/volume.dat
D/libsuperuser( 9783): [libsuperuser][O][SU*] failed: No such file or directory
D/libsuperuser( 9783): [libsuperuser][O][SU*] failed: No such file or directory
D/libsuperuser( 9783): [libsuperuser][O][SU*] failed: No such file or directory
D/libsuperuser( 9783): [libsuperuser][O][SU*] failed: No such file or directory
D/libsuperuser( 9783): [libsuperuser][O][SU*] failed: Invalid argument
as far as I understand, I should expect a [SU%] END in the logcat, but I never get it.
it seems to me that process.waitFor() in Shell.java never returns.
aelmahmoudy commented
Here's the code: https://github.com/aelmahmoudy/darkmatter
aelmahmoudy commented
It seems that the problem is caused by the 'cs' script calling 'su --mount-master -c ', when I commented those lines, the Shell.SU.Run does return !
aelmahmoudy commented
Appending those su lines with < /dev/null fixed it. Thanks