Terminal: Fix opening terminals on remote devices

When the active project is on a remote device the working directory
is set to its root directory. In this case we need to find the right shell
binary from the remote device.

Change-Id: I6b541273d23a8de5442ac041b28d81984ed5ef65
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2024-02-08 17:45:34 +01:00
parent 5328674479
commit e073c54d01

View File

@@ -106,6 +106,17 @@ void TerminalPane::openTerminal(const OpenTerminalParameters &parameters)
}
}
if (parametersCopy.workingDirectory->needsDevice() && !parametersCopy.shellCommand) {
const FilePath shell = parametersCopy.workingDirectory->withNewPath(
parametersCopy.environment
.value_or(parametersCopy.workingDirectory->deviceEnvironment())
.value_or("SHELL", "/bin/sh"));
if (!shell.isExecutableFile())
parametersCopy.workingDirectory.reset();
else
parametersCopy.shellCommand = CommandLine{shell, {}};
}
const auto terminalWidget = new TerminalWidget(&m_tabWidget, parametersCopy);
using namespace Constants;