From 7f632cf4d2c28b367379e30928ae2a71406b41b6 Mon Sep 17 00:00:00 2001 From: agnostic-apollo Date: Fri, 28 Mar 2025 12:32:14 +0500 Subject: [PATCH] Fixed: Generate debug report before deleting broken prefix directory after bootstrap second stage failure to get `stat` info at time of failure --- app/src/main/java/com/termux/app/TermuxInstaller.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/termux/app/TermuxInstaller.java b/app/src/main/java/com/termux/app/TermuxInstaller.java index e81634b3..48c7310c 100644 --- a/app/src/main/java/com/termux/app/TermuxInstaller.java +++ b/app/src/main/java/com/termux/app/TermuxInstaller.java @@ -224,12 +224,13 @@ final class TermuxInstaller { TermuxTask termuxTask = TermuxTask.execute(activity, executionCommand, null, new TermuxShellEnvironmentClient(), true); boolean stderrSet = !executionCommand.resultData.stderr.toString().isEmpty(); if (termuxTask == null || !executionCommand.isSuccessful() || executionCommand.resultData.exitCode != 0 || stderrSet) { - // Delete prefix directory as otherwise when app is restarted, the broken prefix directory would be used and logged into + // Generate debug report before deleting broken prefix directory to get `stat` info at time of failure. + showBootstrapErrorDialog(activity, whenDone, MarkdownUtils.getMarkdownCodeForString(executionCommand.toString(), true)); + + // Delete prefix directory as otherwise when app is restarted, the broken prefix directory would be used and logged into. error = FileUtils.deleteFile("termux prefix directory", TERMUX_PREFIX_DIR_PATH, true); if (error != null) Logger.logErrorExtended(LOG_TAG, error.toString()); - - showBootstrapErrorDialog(activity, whenDone, MarkdownUtils.getMarkdownCodeForString(executionCommand.toString(), true)); return; } }