Skip to content

Commit

Permalink
Fix spurious SHLVL variable assignment by fenv. (#19)
Browse files Browse the repository at this point in the history
Originally, the 2nd `env` call was made within one additional bash subshell
causing the SHLVL variable to differ and therefore be assigned by fenv.

In fish 3.0 this resulted in a warning message because SHLVL is read only.
  • Loading branch information
edlanglois authored and sagebind committed Jan 16, 2019
1 parent a9738ad commit dddd921
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion functions/fenv.main.fish
Expand Up @@ -26,7 +26,9 @@ function fenv.main
set divider (fenv.parse.divider)
set previous_env (bash -c 'env')

set program_execution (bash -c "$program && (echo; echo '$divider'; env)" 2>&1)
# Need to ensure that the two calls to env (here and above) have the same
# nesting level within bash shells so that the SHLVL variable does not differ.
set program_execution (bash -c "$program && echo && echo '$divider' && env" 2>&1)
set program_status $status

if not contains -- "$divider" $program_execution
Expand Down

0 comments on commit dddd921

Please sign in to comment.