What steps will reproduce the problem?
1. make a custom command:
Command command = new Command(0, "tcpdump -nw /sdcard/test.cap") {
@Override
public void commandOutput(int id, String line)
{
}
@Override
public void commandCompleted(int id, int exitcode) {
}
@Override
public void commandTerminated(int id, String reason) {
Toast.makeText(getApplicationContext(), "TCPdump was terminated. Reason:\n" + reason, Toast.LENGTH_LONG).show();
}
};
2. Make sure we don't have a custom shell running, then make custom shell (also
happens with root shell btw), with infinite timeout (or say 99999999), and run
it:
RootTools.closeCustomShell();
RootTools.getCustomShell("su", 0).add(command);
3. and wait..
What is the expected output? What do you see instead?
- Expected output: to not have the commandTerminated handler be called with a
Timeout Exception.
- seen instead: the commandTerminated handler was called with a Timeout
Exception. Exactly 20 seconds after the above code was called.
What is more, the tcpdump process wasn't actually killed:
# before running the above code:
shell@android:/ # ps | grep tcpdump
<no output>
# running code, before timeout exception:
root 31082 31072 3248 876 c0435ed4 40124b2c S
/data/data/net.teclo.NeTrace/app_bins/tcpdump
# running code, after timeout exception:
shell@android:/ # ps | grep tcpdump
root 31082 31072 3248 876 c0435ed4 40124b2c S
/data/data/net.teclo.NeTrace/app_bins/tcpdump
And handily I could also verify the resulting captures, and they showed the
same data as the control capture.
What version of the product are you using? On what operating system?
This was on CyanogenMod, Android 4.2.2, roottools 3.0 and 3.1.
Cheers!