mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-08 03:24:04 +08:00
Respect failsafe sessions in ACTION_EXECUTE
This commit is contained in:
@@ -590,8 +590,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
new AlertDialog.Builder(this).setTitle(R.string.max_terminals_reached_title).setMessage(R.string.max_terminals_reached_message)
|
new AlertDialog.Builder(this).setTitle(R.string.max_terminals_reached_title).setMessage(R.string.max_terminals_reached_message)
|
||||||
.setPositiveButton(android.R.string.ok, null).show();
|
.setPositiveButton(android.R.string.ok, null).show();
|
||||||
} else {
|
} else {
|
||||||
String executablePath = (failSafe ? "/system/bin/sh" : null);
|
TerminalSession newSession = mTermService.createTermSession(null, null, null, failSafe);
|
||||||
TerminalSession newSession = mTermService.createTermSession(executablePath, null, null, failSafe);
|
|
||||||
if (sessionName != null) {
|
if (sessionName != null) {
|
||||||
newSession.mSessionName = sessionName;
|
newSession.mSessionName = sessionName;
|
||||||
}
|
}
|
||||||
|
@@ -136,7 +136,8 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
mBackgroundTasks.add(task);
|
mBackgroundTasks.add(task);
|
||||||
updateNotification();
|
updateNotification();
|
||||||
} else {
|
} else {
|
||||||
TerminalSession newSession = createTermSession(executablePath, arguments, cwd, false);
|
boolean failsafe = intent.getBooleanExtra(TermuxActivity.TERMUX_FAILSAFE_SESSION_ACTION, false);
|
||||||
|
TerminalSession newSession = createTermSession(executablePath, arguments, cwd, failsafe);
|
||||||
|
|
||||||
// Transform executable path to session name, e.g. "/bin/do-something.sh" => "do something.sh".
|
// Transform executable path to session name, e.g. "/bin/do-something.sh" => "do something.sh".
|
||||||
if (executablePath != null) {
|
if (executablePath != null) {
|
||||||
@@ -271,6 +272,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
boolean isLoginShell = false;
|
boolean isLoginShell = false;
|
||||||
|
|
||||||
if (executablePath == null) {
|
if (executablePath == null) {
|
||||||
|
if (!failSafe) {
|
||||||
for (String shellBinary : new String[]{"login", "bash", "zsh"}) {
|
for (String shellBinary : new String[]{"login", "bash", "zsh"}) {
|
||||||
File shellFile = new File(PREFIX_PATH + "/bin/" + shellBinary);
|
File shellFile = new File(PREFIX_PATH + "/bin/" + shellBinary);
|
||||||
if (shellFile.canExecute()) {
|
if (shellFile.canExecute()) {
|
||||||
@@ -278,6 +280,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (executablePath == null) {
|
if (executablePath == null) {
|
||||||
// Fall back to system shell as last resort:
|
// Fall back to system shell as last resort:
|
||||||
|
Reference in New Issue
Block a user