From 4cd5bdc4f6a7ab1578854fb7b0dc3b68c4e5da85 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Tue, 13 Feb 2024 09:17:34 +0100 Subject: [PATCH] LinuxDevice: Show warning if terminal open fails Change-Id: Ifb7a628e7d3f253d834cf8e6503db087def64e0f Reviewed-by: hjk --- src/plugins/remotelinux/linuxdevice.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 80b33c215f5..b166b702d34 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1007,7 +1007,7 @@ LinuxDevice::LinuxDevice() setOpenTerminal([this](const Environment &env, const FilePath &workingDir) -> expected_str { - 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 {}; });