diff options
author | hut <hut@lavabit.com> | 2010-01-11 23:00:27 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-01-11 23:00:27 +0100 |
commit | 5e4496993a297d0c7591084bd54f3df66d4ffe66 (patch) | |
tree | 9867a16a7a06dfd09281754a8aa58629621b6095 /ranger.py | |
parent | 6369406e64208b69a8847aef3b196640bdfc7190 (diff) | |
download | ranger-5e4496993a297d0c7591084bd54f3df66d4ffe66.tar.gz |
fixed #31, cd-after-exit works even after pressing ^C
Diffstat (limited to 'ranger.py')
-rwxr-xr-x | ranger.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ranger.py b/ranger.py index 6915457f..d11b49d9 100755 --- a/ranger.py +++ b/ranger.py @@ -24,9 +24,20 @@ # source /path/ranger /path/ranger """": if [ $1 ]; then + trap "kill -2 %+" INT + RANGER="$1" shift - cd "`$RANGER --cd-after-exit \"$@\" 3>&1 1>&2 2>&3 3>&-`" + + exec 3< <($RANGER --cd-after-exit $@ 3>&1 1>&2 2>&3 3>&-) + read NEWDIR <&3 + exec 3<&- + + cd $NEWDIR + + trap - INT + unset RANGER + unset NEWDIR else echo "usage: source path/to/ranger.py path/to/ranger.py" fi |