Terminal: Fix Id

m_commandLine is not useful to distinguish terminals
as it may contain wrapper scripts with temporary arguments that make each invocation of a target
spawn a new terminal window.

Instead use the provided "shell name".

Also make sure to use the actual target name as the
shell name in runcontrol.

Fixes: QTCREATORBUG-32197
Change-Id: I8c0760be375d559391dbd831080aa7153786f411
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2025-01-09 07:06:09 +01:00
parent ecaa7e1d9f
commit 02d7e59a2e
2 changed files with 10 additions and 8 deletions

View File

@@ -35,7 +35,12 @@ public:
return m_fallbackStubCreator->startStubProcess(setup);
}
const Id id = Id::fromString(setup.m_commandLine.toUserOutput());
const QString shellName
= setup.m_extraData
.value(TERMINAL_SHELL_NAME, setup.m_commandLine.executable().fileName())
.toString();
const Id id = Id::fromString(shellName);
TerminalWidget *terminal = m_terminalPane->stoppedTerminalWithId(id);
@@ -45,14 +50,10 @@ public:
if (!terminal) {
terminal = new TerminalWidget(nullptr, openParameters);
terminal->setShellName(
setup.m_extraData
.value(TERMINAL_SHELL_NAME, setup.m_commandLine.executable().fileName())
.toString());
terminal->setShellName(shellName);
m_terminalPane->addTerminal(terminal, "App");
} else {
terminal->setShellName(shellName);
terminal->restart(openParameters);
}