mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 08:58:01 +00:00
6b243fbcd3
This also caused (isatty < /dev/null) to return 0 since it uses eval, and (ls | cat) to output using the classify indicator style since it uses isatty. This is how I found the bug. Reviewed-by: Grissiom <chaos.proton@gmail.com>
28 lines
655 B
Fish
28 lines
655 B
Fish
|
|
function eval -S -d "Evaluate parameters as a command"
|
|
|
|
# If we are in an interactive shell, eval should enable full
|
|
# job control since it should behave like the real code was
|
|
# executed. If we don't do this, commands that expect to be
|
|
# used interactively, like less, wont work using eval.
|
|
|
|
set -l mode
|
|
if status --is-interactive-job-control
|
|
set mode interactive
|
|
else
|
|
if status --is-full-job-control
|
|
set mode full
|
|
else
|
|
set mode none
|
|
end
|
|
end
|
|
if status --is-interactive
|
|
status --job-control full
|
|
end
|
|
|
|
echo begin\; $argv \;end eval2_inner \<\&3 3\<\&- | . 3<&0
|
|
set -l res $status
|
|
|
|
status --job-control $mode
|
|
return $res
|
|
end
|