nixpkgs-suyu/pkgs/shells/fish-foreign-env/suppress-harmless-warnings.patch
Yurii Rashkovskii edfdc1d818 fish-foreign-env: suppress additional harmless warnings
As per #30645, fish with fish-foreign-env prints this
(harmless) warning:

```
set: Tried to change the read-only variable “_”
```

This patch was developed by @rnhmjoj in the aforementioned
issue discussion
2017-11-14 16:15:58 +07:00

23 lines
649 B
Diff

diff --git a/functions/fenv.apply.fish b/functions/fenv.apply.fish
index 34a25e3..3d94135 100644
--- a/functions/fenv.apply.fish
+++ b/functions/fenv.apply.fish
@@ -27,11 +27,17 @@ function fenv.apply
for variable in $variables
set key (echo $variable | sed 's/=.*//')
set value (echo $variable | sed 's/[^=]*=//')
+ set ignore PATH _
if test "$key" = 'PATH'
set value (echo $value | tr ':' '\n')
end
- set -g -x $key $value
+ if contains $key $ignore
+ set -g -x $key $value ^/dev/null
+ else
+ set -g -x $key $value
+ end
+
end
end