aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlois Wohlschlager <alois1@gmx-topmail.de>2024-09-11 18:46:54 +0200
committerAlois Wohlschlager <alois1@gmx-topmail.de>2024-09-11 19:03:11 +0200
commit82aa1ccab49c187b6b79c4b27af492060df142a4 (patch)
tree432ba1f4c270f1788b4c05f4814c428b4c7abb46
parent24db81eaf28259ab8f8334ccd6368673a26ed422 (diff)
fish-completion: leave the shell prompt intact
When generating shell completions, no logging output should be visible because it would destroy the shell prompt. Originally this was attempted to be done by simply disabling the progress bar (ca946860ce6ce5d4800b0d93d3f83c30d3c953c0), since the situation is particularly bad there (the screen clearing required for the rendering ends up erasing the shell prompt). Due to overlooking the implementation of this hack, it was accidentally undone during a later change (0dd1d8ca1cdccfc620644a7f690ed35bcd2d1e74). Since even with the hack correctly in place, it is still possible to mess up the prompt by logging output (for example warnings for disabled experimental features, or messages generated by `builtins.trace`), simply send it to the bit bucket where it belongs. This was already done for bash and zsh (9d840758a8d195e52e8b7d08cd9c15f6b8259724), and it seems that fish was simply missed at that time. The last trace of the no-longer-working and obsolete hack is deleted too. Fixes: https://git.lix.systems/lix-project/lix/issues/513 Change-Id: I59f1ebf90903034e2059298fa8d76bf970bc3315
-rw-r--r--misc/fish/completion.fish2
-rw-r--r--src/libmain/loggers.cc2
2 files changed, 2 insertions, 2 deletions
diff --git a/misc/fish/completion.fish b/misc/fish/completion.fish
index c6b8ef16a..b7a272c61 100644
--- a/misc/fish/completion.fish
+++ b/misc/fish/completion.fish
@@ -14,7 +14,7 @@ function _nix_complete
# But the variable also misses the current token so it cancels out.
set -l nix_arg_to_complete (count $nix_args)
- env NIX_GET_COMPLETIONS=$nix_arg_to_complete $nix_args $current_token
+ env NIX_GET_COMPLETIONS=$nix_arg_to_complete $nix_args $current_token 2>/dev/null
end
function _nix_accepts_files
diff --git a/src/libmain/loggers.cc b/src/libmain/loggers.cc
index 8c3c4e355..46438280a 100644
--- a/src/libmain/loggers.cc
+++ b/src/libmain/loggers.cc
@@ -7,7 +7,7 @@ namespace nix {
LogFormat defaultLogFormat = LogFormat::raw;
LogFormat parseLogFormat(const std::string & logFormatStr) {
- if (logFormatStr == "raw" || getEnv("NIX_GET_COMPLETIONS"))
+ if (logFormatStr == "raw")
return LogFormat::raw;
else if (logFormatStr == "raw-with-logs")
return LogFormat::rawWithLogs;