about summary refs log tree commit diff stats
path: root/ranger.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-11 23:00:27 +0100
committerhut <hut@lavabit.com>2010-01-11 23:00:27 +0100
commit5e4496993a297d0c7591084bd54f3df66d4ffe66 (patch)
tree9867a16a7a06dfd09281754a8aa58629621b6095 /ranger.py
parent6369406e64208b69a8847aef3b196640bdfc7190 (diff)
downloadranger-5e4496993a297d0c7591084bd54f3df66d4ffe66.tar.gz
fixed #31, cd-after-exit works even after pressing ^C
Diffstat (limited to 'ranger.py')
-rwxr-xr-xranger.py13
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