mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-03 05:34:51 +00:00
Some devices do not have logcat
This commit is contained in:
parent
cccf897194
commit
63f51df94a
1 changed files with 23 additions and 18 deletions
|
@ -1367,27 +1367,32 @@ public class DebugHelper {
|
|||
|
||||
File logcat = new File(context.getFilesDir(), "logcat.txt");
|
||||
|
||||
// https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html#java
|
||||
ProcessBuilder pb = new ProcessBuilder("logcat", // CASA "/system/bin/logcat",
|
||||
"-d",
|
||||
"-v", "threadtime",
|
||||
//"-t", "1000",
|
||||
"fairemail" + ":I");
|
||||
Map<String, String> env = pb.environment();
|
||||
env.clear();
|
||||
pb.directory(context.getFilesDir());
|
||||
try {
|
||||
|
||||
Process proc = null;
|
||||
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(logcat))) {
|
||||
proc = pb.start();
|
||||
Helper.copy(proc.getInputStream(), os);
|
||||
} finally {
|
||||
if (proc != null)
|
||||
proc.destroy();
|
||||
// https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html#java
|
||||
ProcessBuilder pb = new ProcessBuilder("logcat", // CASA "/system/bin/logcat",
|
||||
"-d",
|
||||
"-v", "threadtime",
|
||||
//"-t", "1000",
|
||||
"fairemail" + ":I");
|
||||
Map<String, String> env = pb.environment();
|
||||
env.clear();
|
||||
pb.directory(context.getFilesDir());
|
||||
|
||||
Process proc = null;
|
||||
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(logcat))) {
|
||||
proc = pb.start();
|
||||
Helper.copy(proc.getInputStream(), os);
|
||||
} finally {
|
||||
if (proc != null)
|
||||
proc.destroy();
|
||||
}
|
||||
|
||||
files.add(logcat);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
files.add(logcat);
|
||||
|
||||
attachment.zip(context, files.toArray(new File[0]));
|
||||
|
||||
Helper.secureDelete(logcat);
|
||||
|
|
Loading…
Reference in a new issue