aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/eval.fish
diff options
context:
space:
mode:
authorGravatar liljencrantz <liljencrantz@gmail.com>2007-10-06 20:23:26 +1000
committerGravatar liljencrantz <liljencrantz@gmail.com>2007-10-06 20:23:26 +1000
commit9299515f3e5e1514dc1519d53456bb46d23d13d6 (patch)
treef1f8642974bdc2467a5dba08ccd1a1f5b4ec40cf /share/functions/eval.fish
parent188f0454b700ef43892de7d0cdea73c8795b4ee6 (diff)
'Misfeature' fix for eval function - make it force job control when in interactive mode, in order to make commands that expect to control the terminal happy
darcs-hash:20071006102326-75c98-b168d709d54edb21c478ec2d69420468a2c08da1.gz
Diffstat (limited to 'share/functions/eval.fish')
-rw-r--r--share/functions/eval.fish22
1 files changed, 22 insertions, 0 deletions
diff --git a/share/functions/eval.fish b/share/functions/eval.fish
index f54dee69..34c4e3aa 100644
--- a/share/functions/eval.fish
+++ b/share/functions/eval.fish
@@ -1,4 +1,26 @@
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
+
+ status --job-control $mode
end