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/libs/utils/terminalhooks.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/libs/utils/terminalhooks.cpp')
-rw-r--r-- | src/libs/utils/terminalhooks.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libs/utils/terminalhooks.cpp b/src/libs/utils/terminalhooks.cpp index f1420755c59..6072e168e8a 100644 --- a/src/libs/utils/terminalhooks.cpp +++ b/src/libs/utils/terminalhooks.cpp @@ -6,27 +6,28 @@ #include "externalterminalprocessimpl.h" #include "filepath.h" #include "process.h" +#include "utilstr.h" #include <QMutex> namespace Utils::Terminal { -FilePath defaultShellForDevice(const FilePath &deviceRoot) +expected_str<FilePath> defaultShellForDevice(const FilePath &deviceRoot) { if (deviceRoot.osType() == OsTypeWindows) return deviceRoot.withNewPath("cmd.exe").searchInPath(); - const Environment env = deviceRoot.deviceEnvironment(); - if (!env.hasChanges()) - return {}; + const expected_str<Environment> env = deviceRoot.deviceEnvironmentWithError(); + if (!env) + return make_unexpected(env.error()); - FilePath shell = FilePath::fromUserInput(env.value_or("SHELL", "/bin/sh")); + FilePath shell = FilePath::fromUserInput(env->value_or("SHELL", "/bin/sh")); if (!shell.isAbsolutePath()) - shell = env.searchInPath(shell.nativePath()); + shell = env->searchInPath(shell.nativePath()); if (shell.isEmpty()) - return shell; + return make_unexpected(Tr::tr("Could not find any shell")); return deviceRoot.withNewMappedPath(shell); } |