From 4f1c62ff439005f882664a9bbb9cbb8cfc832157 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 24 Jul 2022 12:36:32 +0200 Subject: [PATCH] status: Realpath the executable path get_executable_path says: "This needs to be realpath'd" So how about we do that? The only other place we use it is fish.cpp, and we realpath it there already. See #9085 --- src/builtins/status.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/builtins/status.cpp b/src/builtins/status.cpp index d6d390f69..4f97a31d0 100644 --- a/src/builtins/status.cpp +++ b/src/builtins/status.cpp @@ -4,6 +4,7 @@ #include "status.h" #include +#include #include #include @@ -453,9 +454,14 @@ maybe_t builtin_status(parser_t &parser, io_streams_t &streams, const wchar break; } case STATUS_FISH_PATH: { - CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd) - streams.out.append(str2wcstring(get_executable_path("fish"))); - streams.out.push_back(L'\n'); + CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd); + auto real = wrealpath(str2wcstring(get_executable_path("fish"))); + if (real) { + streams.out.append(*real); + streams.out.push_back(L'\n'); + } else { + streams.err.append_format(L"realpath failed: '%s'\n", cmd, std::strerror(errno)); + } break; } }