LinuxDevice: Show warning if terminal open fails

Change-Id: Ifb7a628e7d3f253d834cf8e6503db087def64e0f
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-02-13 09:17:34 +01:00
parent f905ad1aa6
commit 4cd5bdc4f6

View File

@@ -1007,7 +1007,7 @@ LinuxDevice::LinuxDevice()
setOpenTerminal([this](const Environment &env,
const FilePath &workingDir) -> expected_str<void> {
Process proc;
Process *proc = new Process;
// If we will not set any environment variables, we can leave out the shell executable
// as the "ssh ..." call will automatically launch the default shell if there are
@@ -1015,11 +1015,19 @@ LinuxDevice::LinuxDevice()
// specify the shell executable.
const QString shell = env.hasChanges() ? env.value_or("SHELL", "/bin/sh") : QString();
proc.setCommand({filePath(shell), {}});
proc.setTerminalMode(TerminalMode::Detached);
proc.setEnvironment(env);
proc.setWorkingDirectory(workingDir);
proc.start();
proc->setCommand({filePath(shell), {}});
proc->setTerminalMode(TerminalMode::Run);
proc->setEnvironment(env);
proc->setWorkingDirectory(workingDir);
proc->start();
QObject::connect(proc, &Process::done, proc, [proc](){
if (proc->exitCode() != 0){
qCWarning(linuxDeviceLog) << proc->exitMessage();
Core::MessageManager::writeFlashing(proc->exitMessage());
}
proc->deleteLater();
});
return {};
});