Fixed: Do not assume failure if stderr is set for bootstrap second stage as a postinst script could be using stderr for logging

Exit code `0` should be enough to check for failure.
This commit is contained in:
agnostic-apollo
2025-03-29 09:27:19 +05:00
parent 2522c62173
commit 8f156dc58f

View File

@@ -228,8 +228,7 @@ final class TermuxInstaller {
executionCommand.commandLabel = "Termux Bootstrap Second Stage Command"; executionCommand.commandLabel = "Termux Bootstrap Second Stage Command";
executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_NORMAL; executionCommand.backgroundCustomLogLevel = Logger.LOG_LEVEL_NORMAL;
TermuxTask termuxTask = TermuxTask.execute(activity, executionCommand, null, new TermuxShellEnvironmentClient(), true); 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) {
if (termuxTask == null || !executionCommand.isSuccessful() || executionCommand.resultData.exitCode != 0 || stderrSet) {
// Generate debug report before deleting broken prefix directory to get `stat` info at time of failure. // Generate debug report before deleting broken prefix directory to get `stat` info at time of failure.
showBootstrapErrorDialog(activity, whenDone, MarkdownUtils.getMarkdownCodeForString(executionCommand.toString(), true)); showBootstrapErrorDialog(activity, whenDone, MarkdownUtils.getMarkdownCodeForString(executionCommand.toString(), true));