From e073c54d0115c8f64145e4097406c2ee761675ec Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 8 Feb 2024 17:45:34 +0100 Subject: [PATCH] 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 Reviewed-by: --- src/plugins/terminal/terminalpane.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/terminal/terminalpane.cpp b/src/plugins/terminal/terminalpane.cpp index 111e6d2d992..096fffcba1f 100644 --- a/src/plugins/terminal/terminalpane.cpp +++ b/src/plugins/terminal/terminalpane.cpp @@ -106,6 +106,17 @@ void TerminalPane::openTerminal(const OpenTerminalParameters ¶meters) } } + 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;