diff options
author | Marcus Tillmanns <[email protected]> | 2023-10-06 08:51:17 +0200 |
---|---|---|
committer | Marcus Tillmanns <[email protected]> | 2023-10-06 08:26:15 +0000 |
commit | 1fabd72514a6fdf529cbbc1a19c13ad537edd8dd (patch) | |
tree | 836685d510c3d50fcde3bb6015c180e0107cbda9 /src/plugins/terminal/terminalwidget.cpp | |
parent | 113efbfc85aed462902ea115ed9ace385b0b1f07 (diff) |
DeviceSupport: Add more error output
Previously most errors when opening shells were completely
opaque to the user. This patch adds error output either via
QMessageBox if there is another modal dialog, or as flashing
disrupting messages.
Change-Id: I54be7a90295b61c23c739294c2d1d37c288ad273
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/terminal/terminalwidget.cpp')
-rw-r--r-- | src/plugins/terminal/terminalwidget.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp index 681ad9c538f..604a0d82bc8 100644 --- a/src/plugins/terminal/terminalwidget.cpp +++ b/src/plugins/terminal/terminalwidget.cpp @@ -87,25 +87,28 @@ void TerminalWidget::setupPty() if (shellCommand.executable().isRootPath()) { writeToTerminal(Tr::tr("Connecting ...\r\n").toUtf8(), true); // We still have to find the shell to start ... - m_findShellWatcher.reset(new QFutureWatcher<FilePath>()); + m_findShellWatcher.reset(new QFutureWatcher<expected_str<FilePath>>()); connect(m_findShellWatcher.get(), &QFutureWatcher<FilePath>::finished, this, [this] { - const FilePath result = m_findShellWatcher->result(); - if (!result.isEmpty()) { - m_openParameters.shellCommand->setExecutable(m_findShellWatcher->result()); + const expected_str<FilePath> result = m_findShellWatcher->result(); + if (result) { + m_openParameters.shellCommand->setExecutable(*result); restart(m_openParameters); return; } - writeToTerminal( - ("\r\n\033[31m" + Tr::tr("Could not find shell to start.") + "\r\n").toUtf8(), true); + writeToTerminal(("\r\n\033[31m" + + Tr::tr("Failed to start shell: %1").arg(result.error()) + "\r\n") + .toUtf8(), + true); }); - m_findShellWatcher->setFuture(Utils::asyncRun([shellCommand] { - const FilePath result = Utils::Terminal::defaultShellForDevice( + m_findShellWatcher->setFuture(Utils::asyncRun([shellCommand]() -> expected_str<FilePath> { + const expected_str<FilePath> result = Utils::Terminal::defaultShellForDevice( shellCommand.executable()); - if (result.isExecutableFile()) - return result; - return FilePath{}; + if (result && !result->isExecutableFile()) + return make_unexpected( + Tr::tr("'%1' is not executable.").arg(result->toUserOutput())); + return result; })); return; |