summary refs log tree commit diff stats
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
parent6369406e64208b69a8847aef3b196640bdfc7190 (diff)
downloadranger-5e4496993a297d0c7591084bd54f3df66d4ffe66.tar.gz
fixed #31, cd-after-exit works even after pressing ^C
-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
8d10ac82be9c6e0cb68c2011'>^
a0e543f8 ^
110dd383 ^

26962ded ^






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56