summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rwxr-xr-xranger.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/TODO b/TODO
index 52812959..8f1c5a42 100644
--- a/TODO
+++ b/TODO
@@ -37,7 +37,7 @@ Bugs
    (X) #23  10/01/04  stop dir loading with ^C -> wont load anymore
    (X) #25  10/01/06  directories sometimes dont reload correctly
    (X) #26  10/01/06  :delete on symlinks of directories fails
-   ( ) #31  10/01/06  ^C breaks cd-after-exit by stopping sourced shell script
+   (X) #31  10/01/06  ^C breaks cd-after-exit by stopping sourced shell script
 
 
 Ideas
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